In article
,
wrote:
> I'm working with Win Xp /FMPro Advanced 8.5v2
>
> I'm trying to use a script to find all records containing a value less
> or equal to the value of a variable.
>
> I have a local variable ($A) set to some number and I need to find all
> records with value less than or equal to $A in a given field.
>
> When the script enters find mode and puts <$A then the find fails. It
> looks like it actually searches for <$A rather than values less than
> $A?
>
> If I change the script to find all records with the field <5 it works
> fine. Additionally if I set the script to find all records with $A in
> the particular field the search works fine and returns all records
> with exactly $A in that field.
>
> Is there an easy way to have a scripted find for values less than or
> equal to a local variable?
>
> Any ideas would be greatly appreciated.
I would guess that you are using an incorrect command like:
Set Field [FieldName, "<=$A"]
which will give you exactly what you getting - records where the data
is less than the text "$A" itself because that's what you are telling
FileMaker you want.
Instead you have to use the concatenation operator "&" to join together
the text "<=" and the value stored in the variable $A.
eg.
Set Field [FieldName, "<=" & $A]
Note: "<=" can be left as it is or replaced with the combined 'less
than or equal' symbol - either will work in FileMaker (the combined one
just won't display in Newsgroup messages).
FileMaker can also be a little fussy about how scripts put data into
fields for Find mode, so you might have to try a different command to
Set Field.
eg.
Insert Calculated Result [FieldName, "<=" & $A]
Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
>> Stay informed about: scripted find using local variable