George Posted January 21, 2001 Posted January 21, 2001 I am trying to create a conditional button based on this script that it plays: If ["Status(Currentfoundcount) = 0"] copy[select, "chartno"] Enter find mode [] Paste[select, "chartno"] Perform find [] Else Show all records End If I can't seem to get it to see the Status(Currentfoundcount) argument. I want the button to act as a togle of just the Chartno related records or all records. Thanks
LiveOak Posted January 21, 2001 Posted January 21, 2001 Is chartno. a global? If not, how can you copy the value in a field when no records are found? -bd
George Posted January 21, 2001 Author Posted January 21, 2001 Chartno is a text field. I am issuing the copy command before entering the find mode. When in "show all" mode, I would be viewing a record in the table. I want the button script to perform a find on the records that match chartno only, then on the next click of the same button I want to once again "see all records". If I just leave the script with the following it works, but when I introduce the status function it seems to have a problem at that point. copy[select, "chartno"] Enter find mode [] Paste[select, "chartno"] Perform find []
Vaughan Posted January 22, 2001 Posted January 22, 2001 LiveOak is right: the conditional will only perform the copy/find if there is an empty found set, which is invalid. In fact, under most circumstances FMP considers an empty found set to be an error condition. Now, what exactly are you checking for? Are you trying to work out whether a find has been performed and there are records found? If so then the logic behind the test needs work. When there is NO found set all the records are in essence "found" so Status(CurrentFoundCount) = Status(CurrentRecordCount). So your statement should be... If ["Status(CurrentFoundCount) = Status(CurrentRecordCount)"] Show all records Else copy[select, "chartno"] Enter find mode [] Paste[select, "chartno"] Perform find [] End If I have to add that this doesn't make sense, the "show all records" step is unnecessary because if there isn't a found set then all of the records are already shown. [This message has been edited by Vaughan (edited January 21, 2001).]
George Posted January 22, 2001 Author Posted January 22, 2001 Vaughan Thanks, that is exactly what I needed. As I was trying to describe, the script would always work, (copy selected field, then enter find mode, then paste clipboard into selected field, perform find), when all records were showing, I just needed the proper argument for when there were found records to execute the "else" condition. By changing the Status(currentfoundcount) = 0 to that shown below, the "togle" feature works by clicking on the assigned button. If ["Status(Currentfoundcount) = Status(CurrentRecordCount"] copy[select, "chartno"] Enter find mode [] Paste[select, "chartno"] Perform find [] Else Show all records End If [This message has been edited by George (edited January 21, 2001).]
john.daly Posted January 22, 2001 Posted January 22, 2001 You could also use: If[status(CurrentError) = 401] This is the error number generated when no records match the find request.
Recommended Posts
This topic is 8711 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 accountSign in
Already have an account? Sign in here.
Sign In Now