Jump to content

How to pass a parameter between two scripts


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

Recommended Posts

Hello,

My question is quite simple: I have a script in the Client database that create a new memo in another database. So, this script calls a sub-script from the Memo database. How can I pass the ClientID from the first script to the second one?

Thanks in advance (and sorry for my poor English),

Pierre

Link to comment
Share on other sites

You can set a global in either the Client db or the Memo one, and reference it in the sub-script either by its name (if it lives in the Memo file) or any relationship to the Client file (if it lives in the Client one).

Link to comment
Share on other sites

To accomplish this I've created a generic relationship between the Memo file and the client by defining a calculation: c=1 in both files. Then you can create the relationship from the Memo file back to the Client a grab the global Client ID create a new record, and populate the foreign key in the new Memo record with the Client ID. Probably many ways to do this but this works for me. Best. K

Link to comment
Share on other sites

You can use any relationship to the Client file; it need not even be valid at the time of use.

You can also use a technique like this one to avoid setting a global to hold the data altogether.

Link to comment
Share on other sites

Thanks for your help. So, I managed to do it with the following script... and after having marked "Allow creation of related records" in the relationship between the client table and the memo table:

WriteNewMemo

Go to Field [Memo::Memo_Date]

# There is a portal listing the memos in the client layout:

Go to Portal Memo [Last, Select entire contents]

Set Field [Memo::Memo_Date, Today]

Go to Related Record [Memo]

Perform Script [Filename:"Memo.fp5", "NewMemo"] [sub-scripts]

Best regards,

Pierre

Link to comment
Share on other sites

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