isValid?

In FMP, I use IsValid a lot, to check whether there’s a related value.

Now, in Servoy, I can’t seem to figure out how to do that. There are cases when I want to update related records if there are any. If I try to update and there’s no records, I get errors.

I thought size() would do it, but size() itself seems to be giving me an error when it’s zero…

Once again, probably easy, but…

The Advanced Guide for FMP Developers mentions creating a global method, but 1) doesn’t say what that would look like and 2) seems to be referring to a different use of isValid, anyway.

Perhaps, once again, I’m looking in the wrong pdf? I’m willing to rtfm, but sometimes I can’t figure out which fm, or where in the fm, to look. ;-)

with ```
if (relationshipname) { }

When you want to check if there is a relationship AND related records you can use ```
if (databaseManager.hasRecords(relationshipname)) { }
```...

Cheers Marcel

IT2BE:
with ```
if (relationshipname) { }

If you want to check a relation’s validity, you can also use

if (relationshipname.field) { }

where “field” is the key the relation is based on.

Of course, with “hasrecords” you don’t have to know the FK…

Thanks, guys!