Jump to content
Server Maintenance This Week. ×

Unexpected variable find?


This topic is 3604 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I've attached a simple fp7 file - it works the same in version 11-13:

 

If we Enter Find Mode and set the value with "$var" in quotes, it fails because it places $var in the field to search instead of the $var value.  That is what I would expect.

 

But if we use Perform Find [ Restore ] and place "$var" in quotes, it works ... finding the value in $var.  It does NOT place $var as the search value.  I would have thought that wrapping with quotes would have broken the Perform Find [ restore ], acting as the first example and inserting $var into the field to search.

 

I assume it is because Restore expects literal values ... but I am unclear on the real reasoning behind this behaviour.  It is unexpected to me!!  Or does FM see the $ and ignore the quotes?


I suppose it is because Restore always assumes anything entered is quoted but it strikes me as off.

TestVar.fp7.zip

Link to comment
Share on other sites

There are no calculations performed within a find request. Recognizing a known(!) variable is kind of an exception to this rule. Still, quotes within a find request have a special meaning, so doing:

Set Variable [ $searchCriteria; Value:"some text" ]
Perform Find [ Specified Find Requests: Find Records; Criteria: MyTable::MyField: “"$searchCriteria"” ][ Restore ]

is the equivalent of:

Enter Find  Mode [ ]
Set Field [ MyTable::MyField ; """ &  "some text" & """ ]
Perform Find [ ]

You can test this by running the following script:

Set Variable [ $searchCriteria; Value:"some text" ]
Enter Find Mode [ Specified Find Requests: Find Records; Criteria: MyTable::MyField: “"$searchCriteria"” ][ Restore ]

and observing the resulting criteria before performing the actual find.

 

Link to comment
Share on other sites

This topic is 3604 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.