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.

Is there a Get (LastError )=401 for related record

Featured Replies

Hi,

In search mode, when no records are found, we can use the Get ( LastError )=401.

But within a relationship with the Go To Related Records script?

How can I know that no record is related ?

It's weird, because if the user clicks on a button with the Go To Related records script, and that no record is shown, then nothing happen.

Chris

One great advantage of relationships is that you can check BEFORE you use them. First, you need a field that you're sure has data in it in the related table; or at least would have data for that relationship, such as the right hand key of the relationship.

If [ not IsEmpty(relationship::field) ]

Go To Related Record ["relationship"]

Else

Do whatever if no match

End If

  • Author

Thanks Fenton for your interesting idea. But in this case, I've forgotten to specify that it is a self joined relationship and a ">" type. The right hand key is thus always filled.

By the way, maybe I can explain why I use this scheme : I'm reluctant to use the perform find function, because I think relationships are faster. But it may be a false idea. What do you think ?

It doesn't make any difference. If there's none greater, the related field is empty, when you try to access it via the relationship. Try it. Yes, relationships are faster.

  • 5 weeks later...
  • Author

Ah... I found something.

Just use the ErrorCode 101 ("record is missing").

set Error Capture (On)

Go to related record

if (Get(LastError)=101)

beep : "not found"

end if

No need to go to a related record when none exist. It's easier to do as Fenton wrote,

If [not IsEmpty(relationship::serial)]

Go to Related Record [show only related; relationship]

Else

Show Custom Dialog ["No related records exist."]

End If

If there are one or more related records, then relationship::serial (the right-hand key) will not be empty.

I use Count (relationship::keyfield ) > 0, but it has been suggested that this is slower.

Yes, if there are multiple related records, then Count would be slower. IsEmpty only checks the first related field and doesn't have to count anything, just return a boolean. I assume it would only need to test whether Left( field; 1 ) is empty. But I'm not sure if it does test the entire field. Either way, it would theoretically be faster.

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.