Jump 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.

return error message when there are no valid relations??

Featured Replies

I'm using a relationship to perform a find based on a date range. How can I return a message in a script when there are no valid relations.

Hi Hagy,

I assume you mean before a GTRR to test that there are related records? Use any non-empty standard field from your related file. For instance, if there is a serial, script portion to use:

If [ IsEmpty(ChildTable::Serial) ]

Show Custom Dialog [ OK ; "No records found" ]

Exit Script

End If

LaRetta :wink2:

Or, if you're scripting a search and want to capture no records found:

Set Error Capture [On]

Enter Find Mode

Set Field [YourField, yourCriteria]

Perform Find []

If [Get(LastError) = 401 /* No records found */ ]

Show Custom Dialog[ Crank; "Bummer, Dude"]

Exit Script

End If

I assume you mean before a GTRR to test that there are related records? Use any non-empty standard field from your related file. For instance, if there is a serial, script portion to use

I can't help finding David Kaschel wise, when he says:

For every table you create, the first field in that table should always be a unique ID field. The best and only completely reliable way to do this is to create a number field that is auto-enter, serial number, incremented by one, cannot override. This will be the single most reliable and predictable method to identify and relate your records.

This means that a somewhat nearer to machinecode than either IsEmpty( ... IsValid( or Count( for that matter can be utilized, namely:

If [ 1 xor PortalStuff::portRecID ] 

     Show Custom Dialog [ Message: "No related exists!!!"; Buttons: “OK” ] 

Else 

      Go to Related Record [ From table: “PortalStuff”; Using layout: “PortalStuff” (PortalStuff) ] 

End If 

...since the portRecID is a integer!

--sd

1 xor PortalStuff::portRecID

==

not PortalStuff::portRecID

One less evaluation to make (of the always-true 1), and much easier to read, I think?

  • Author

Thanks Guys.

well 1 xor evaluate despite, the field is empty. So if an IF statement only looks for 1's and not 0's are you absolutely right!

A quick test seems to confirm it!!!! Regarding the read-ability is it a matter of habit, I sprinkel my stuff with 1 xor- and 0 xor's and can spot them right away, opposed to where say not not somtimes disappears, and if I'm desiding to reverse the logic ...is it just first # I'll change, instead of rearranging the lines in the statement.

--sd

Create an account or sign in to comment

Important Information

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

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.