AnsweredAssumed Answered

How do I detect an empty set after a search?

Question asked by ArturoDeguza on Nov 9, 2011
Latest reply on Nov 9, 2011 by ArturoDeguza

Title

How do I detect an empty set after a search?

Post

Hello All:

 

I am trying to branch off my script with an if statement depending on the results of a search.

 

What condition would I use for the if statement? I thought FMP returns an "401" error code when search returns no results, and I am currently using it but it is not working.

 

Here is my script:

 

Set Error Capture [ On ]

Go to Layout [ “search_layout” ]

Enter Find Mode[ Pause ]

Set Field [ PSC_ECO::gErrorCaptureField; Get (LastError) ]

If [ PSC_ECO::gErrorCaptureField = 401 ]  

       Show Custom Dialog ["Not Found"; "This ECO does not exist. Are you sure your entries are correct?"]

Else  

       Go to Layout [ “PSC_ECO” ]

End If

 

Thanks!

 

Deguza

 

Outcomes