Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6523 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

Hi All, I've written a script that checks if a related record (R/R) exists for the current record using the find process. If a R/R exists the script automatically goes to it, if no R/R exists (error code 401) the script asks if one should be generated.

I would like to use the GTRR script step rather than a find but I can't find an error code to match no R/Rs found in this case?

Thanks Peter :-)

Edited by Guest
Posted

Try using the isValid script step.

If [ IsValid(Graphic link|::Container) ]

Go to Related Record [ Graphic link| ]

Else

Show Message [ Buttons: “OK”, “Cancel”, “”; Data: “No Related Record exist.” ]

End If

HTH

Lee

Posted (edited)

Hi Lee, I'll give it a try, I was hoping there might be an error code for no R/R found but maybe there isn't.

Thanks Peter :-)

Edited by Guest
Posted (edited)

You could also just use

Set Variable[$layoutName ; Get(LayoutName)]

Go To Related Record[GraphicLink]

If[ $layoutName = Get(LayoutName)]

#Create the record

Else

Go To Related Records [ You know this bit ]

End If

--If there aren't any related records you remain on the same layout.

or use isEmpty on the primary key field in the related table.

If[ IsEmpty( RelatedTable::PrimaryKeyField )]

#Create the record

Else

Go To Related Records [ You know this bit ]

End If

This one may or may not also work:

415

One or more required related records are not available

Edited by Guest
Posted

You can also set error capture on, try to go to related record and read the last error state. That is

Set Error Capture[ On ]

Go To Related Record[  ]

Set Variable[ $$error, Get( LastError ) ]

Set Error Capture[ Off ]

I don't remember the error code exactly, but it certainly exists.

Posted

101 - Record is missing

But it seems neater to do the test beforehand and branch accordingly:

If [ not IsEmpty ( Child::ParentID ) ]

Go To Related Record [ Child ]

# Do the stuff

Else

# Do something else

End If [ ]

Posted

Thanks to everyone for their ideas, I'll experiment with the ideas later on when it's less than 35 degrees Celsius :-)

My script currently checks if a R/R exists first then branches from there, it's just using the find record step, etc. was a bit messy so I was hoping this could be accomplished in less steps.

Cheers Peter :-)

This topic is 6523 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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