Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

If else end

Featured Replies

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

Is chartno. a global? If not, how can you copy the value in a field when no records are found? -bd

  • Author

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 []

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).]

  • Author

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).]

You could also use:

If[status(CurrentError) = 401]

This is the error number generated when no records match the find request.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.