dbTalk Databases Forums  

Newbie question on Set Field

comp.databases.filemaker comp.databases.filemaker


Discuss Newbie question on Set Field in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
JoeT
 
Posts: n/a

Default Newbie question on Set Field - 12-02-2006 , 02:16 PM






Hi...

If I create a script and I type in:

Set Field[Table::value,"<10"]

the script works as I expect.

But, If I click on the calculated button in ScriptBuilder, and click my
selections, ScriptBuilder generates:

Set Field[Table::value,Table::value < 20]

This one doesn't work.

Can anyone explan to me what the difference is and why?

TIA,
Joe


Reply With Quote
  #2  
Old   
Bill Marriott
 
Posts: n/a

Default Re: Newbie question on Set Field - 12-02-2006 , 03:38 PM






There are so many inconsistencies here I don't know where to begin.

I'm wondering where you are "typing in" in the first example.

I'm also wondering what you're trying to do with the value "<10" and whether
it's significant that in one instance it's "<10" and in another it's "< 20."

Then there's the matter of whether you want the literal value "< 20" (or
"<10") to be entered into the field, such as you might do after entering
Find mode, or whether you're trying to do some logic comparison. (I suspect
it's the former.)

The set field step in ScriptMaker has two components: the field you are
trying to operate upon, and the calculated value you're trying to set it to.

The "calculated value" part won't accept a plain entry of

<10

you would have to either enclose it within quotes

"<10"

to indicate you want the literal, three characters <, 1, 0 entered into the
field, or you would have to express it as an "equation"

Something <10

to indicate a Boolean (true or false) result.

The difference in the two examples you listed is that in the first one, you
are instructing ScriptMaker to set the value of the field to the literal
"<10" and in the second you are specifying to set the value of the equation
Table::Value < 20.

You also don't say which version of FileMaker you are using.

If what you're doing is trying to automate a search, and you're using
FileMaker 7 or later, then you probably want to use the "Perform Find"
script step, which will have the more natural interface for specifying what
you're looking for.


"JoeT" <trubisz (AT) yahoo (DOT) com> wrote

Quote:
Hi...

If I create a script and I type in:

Set Field[Table::value,"<10"]

the script works as I expect.

But, If I click on the calculated button in ScriptBuilder, and click my
selections, ScriptBuilder generates:

Set Field[Table::value,Table::value < 20]

This one doesn't work.

Can anyone explan to me what the difference is and why?

TIA,
Joe




Reply With Quote
  #3  
Old   
Grip
 
Posts: n/a

Default Re: Newbie question on Set Field - 12-02-2006 , 04:53 PM



When you Set Field, you're asking Filemaker to evaluate a calculation.
In the first example the calculation is "<10" and FM calculates
anything in quotes as being that literal text. In the second example,
you're evaluating the calculation Table::Value<20 Filemaker
interprets that as asking if that expression is true or not. If the
Table::Value is less than 20, the expression is true and FM will return
1, otherwise it will set your field to 0.

G
I don't know what script builder is, but in the first example you're
setting the field to "<10" in the other you're setting it to the field
to either 1 or 0, depending on the current value of the field.

Quote:
Set Field[Table::value,"<10"]

the script works as I expect.

But, If I click on the calculated button in ScriptBuilder, and click my
selections, ScriptBuilder generates:

Set Field[Table::value,Table::value < 20]

This one doesn't work.

Can anyone explan to me what the difference is and why?

TIA,
Joe


Reply With Quote
  #4  
Old   
Helpful Harry
 
Posts: n/a

Default Re: Newbie question on Set Field - 12-02-2006 , 05:33 PM



In article <1165090564.714581.197620 (AT) l12g2000cwl (DOT) googlegroups.com>,
"JoeT" <trubisz (AT) yahoo (DOT) com> wrote:

Quote:
Hi...

If I create a script and I type in:

Set Field[Table::value,"<10"]

the script works as I expect.

But, If I click on the calculated button in ScriptBuilder, and click my
selections, ScriptBuilder generates:

Set Field[Table::value,Table::value < 20]

This one doesn't work.

Can anyone explan to me what the difference is and why?

I don't quite know what "the script works as I expect" means since we
have no idea what the script is meant to be doing, but the difference
is basically caused by using the quote marks (") in the first example
and not in the second.

Set Field[Table::value,"<10"]
This sets the value of the field Table::value to the TEXT "<10"
(without quotes).


Set Field[Table::value,Table::value < 20]
This sets the field Table::value to the CALCULATED value of
"Table::value < 20" - since this is a boolean test (just like those
used in an If or Case statement), the value is calcuated as either:

0 (or "false") when Table::value is 20 or more

or 1 (or "true") when Table::value is less than 20


If, for example, you're trying to set the Table::value field to have
the data "10 < 20" (without quotes) when Table::value is originally 10,
then you'll need to make use of the "&" concatenation operator.
ie.
Set Field [Table::value, Table::value & " < 20"]

That will calculate as appending the TEXT " < 20" to the end of the
original value of Table::value.




Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.