this is too vague.
what is the purpose of this script?
try to give more data about it.
I have simplified the code here.
I have a Tableview layout with a numeric field p.I use table view because it displays the related data very nicely. P is located in the header of the layout. I can nicely manually change p to find tableviews for a given value of p. However if I use the find in a loop which increments p over a range of values p is not being used in the set field step before the perform find command.
When I get this to work I will place a print command after the perform find. So this will print out tableviews with different values of p.
The reason why is because enter find mode is not in your loop.
so your script does this:
enter find mode
perform find [which means exit find mode]
Try this:Show custom Dialog(Input #1:firstprint,Input#2:lastprintEnter find mode
Set field (p;firstprint)
exit loop if (p>lastprint)
Set variable [$f:Value $f+1]enter find mode
Set Field[p;$f]End loopDoes this help?
And actually, in the last example I gave you, the script would end in find mode, which is no good, so here it is again, modified:Show custom Dialog(Input #1:firstprint,Input#2:lastprintEnter find mode
Set field (p;firstprint)
Set variable [$f:Value $f+1]exit loop if (p>lastprint)enter find mode
Your suggestions did not work. P never gets into the perform find.
Thank you for your post.
Are "firstprint" and "lastprint" global fields? If not, then those values will only be available to the current record when you called the script. Therefore, store those values to variables.
# input your data
Show Custom Dialog [ Input #1:firstprint, Input #2:lastprint ]
# Make sure lastprint is greater than firstprint
If [ firstprint > lastprint ]
# Store firstprint and lastprint to variables $first and $last
Set Variable [ $first ; firstprint ]
Set Variable [ $last ; lastprint ]
Set Error Capture [On]
# Enter Loop
# Search the P field for the value in $first
Enter Find Mode 
Set Field [ P ; Value: $first ]
Perform Find 
# make sure there are records to print
If [ Get (FoundCount) > 0 ]
<do your print functions here>
# increment $first
Set Variable [ $first ; $first + 1 ]
Exit Loop If [ $first > $last ]
Set Error Capture [Off]
The Set Error Capture allows you to trap errors. I put this in just in case the Find doesn't find a specific value. You can then skip over this value and move on to the next value.
Let me know if you need clarification for any of the above steps.
TGAL your solution works!