April 21, 200520 yr I'm trying to create a script which allows the user to perform a find... and based on the number of records found I would like to change the layout. If the found set is 1 ... I display the detail layout and if the found set is greater than 1 ... I display a list so they can select which detail record they want to look at. But it seems the "Get(FoundCount)" is not available until the script that is running has completed. Thanks for your help Glenn
April 21, 200520 yr It works for me: Perform Find[] If [ Get(FoundCount) = 1 ] Go to Layout [ Detail ] Else Go to Layout [ List ] End If
April 21, 200520 yr Author Tried this before .... And one more time ... this is not working for me Thanks Glenn
April 21, 200520 yr Author here is a screen picture of the the script running in debug Thanks for your help glenn FileMakerDeveloperScreenSnapz001.pdf
April 21, 200520 yr Try: Enter Find Mode[] Pause Script[] Perform Find[] If [ Get(FoundCount) = 1 ] Go to Layout [ "Test Find" (Customers) ] Else Go to Layout [ "CustSearchList" (Customers) ] End If
April 22, 200520 yr Author Thanks .... I'll give this a try first thing tomorrow AM... I have a 13yr old birthday party to attend. thanks glenn
April 22, 200520 yr glenneg, because you went into find mode but you didn't tell it to perform the find. Once you enter it, you are just in the command to let you put in the criteria that you want to find. So, I usually do: set error capture [on] //this is used so you can use the error to display the messages go to layout (and pick the layout you want the user to use) enter find mode [pause] Now up to here you are ready to perform the find perform find[] if[get(LastError=400)] show custom dialog["blah blah box"; "you didn't enter any criteria..blah blah..."] show all records else If[Get(foundcount)=0] show custome dialog["blah blah box"; "No records match your request"] show all records go to layout[main] else If[Get(foundcount)=1] go to layout[onerecordview] else go to layout end if end if end if Now with any of the "If(get(foundcount)= " you can do any command you want even perform another script. I like to play around with them. You can do some pretty cool things. Another, if you perform a find, then go back into script maker and copy that script, in the perform find command, you can click on "specify find request" and it will show your last find. That way you don't need to put a pause area in it and just make a button for the user if that is a scearch they always use... Good luck and keep trying.
April 23, 200520 yr Author Thanks for the tips and explaination.... it sure helps have a great weekend glenn
Create an account or sign in to comment