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

Conditional create record, with find button.


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

Recommended Posts

Posted

I need a script that will either go to a related record, or create a new record if no related record exists.

The application is a job that has 3 componets, I need 3 buttons 1 for each component that will be "goto / create" buttons. For the details held in each of the component tables.

Can someone suggest a script to do this?

Thanks

Daniel

Posted

.. im a bit confused... but for the if no related record create new... (im assuming you want to create it in the original table and go back to the original layout...)

SetErrorCapture (On)

Goto Related Record (bla bla bla bla)

If (GetLastError) = 0

GotoLayout (Back to original layout)

Else

Create New Record / Request

End If

Posted

I am in table 1 - I want to go to the related record in table 2, if it exists, if not I want to create a record in table 2 that is related to the record in table 1.

Table 1 holds some initial details about a booking, with the rest being filled in table2. The will only ever be one related record in table 2 for one record in table 1.

Initially to create the record I set a veriable to the ID in table1 , went to table 2 and set the field to that value, hence creating a related record. I set that field to have to be unique, to prevent two booking records being created.

I then had another button, to go to table2 nd search on the ID from table1. ie "goto booking". It would be nice to place the functionality in one button.

Thanks for the script I will give it a go!

Posted

ok, see the logic, but I can't work out how to input the "If (GetLastError) = 0" part of the script. If I select If in the calculation field i get "The specified table cannot be found"

help!

Posted

... no no... you want a button ok... and attach the following script to it... or close to it anyway... im paraphrasing scripting here...:

- SetErrorCapture(on)

- Freeze Window

- SetVariable or Global whatever = your ID

- Goto Related Record (Select the related table occurance and a layout that uses that table...)

- If (GetLastError)(doesnt equal) 0

- Create New Record / Request

- Set Field (Related ID = Your variable or global)

- End If

- Goto Layout (back to where you came from)

... i no its a bit scanny, but its all ive got time for, hope it helps

Genx

Posted

aflgenx,

sorry for not posting back, actually helped a lot, I have been going over all sorts of scripts to learn how the work.

Its nice to see one that is directly relivent to what I an trying to achive.

Thanks again

This topic is 6877 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.