Jump to content

Auto insert foreign key


Martin The

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

Recommended Posts

  • Newbies

Hi guys,

I am teaching myself FM, and I have a sticking point right now.

How do I auto insert a foreign key from another table?

Say I have a customer details with a unique ID, then I jumped from customer layout to order layout. Then I want to create a new order, clicking a the new record button, then I want that FM automatically fills in the customer ID (foreign key) with the active customer ID. How is it done? I have relationship set-up, but it does not auto fill.

Thank you in advance.

Regards,

Martin

Link to comment
Share on other sites

You have apparently reasons to avoid the portal with the dangling empty box in a realtion with "allow creation..." Then could the button that make you jump to the order layout, could be stuffed this way:

If [ Length ( Clients::ClientID ) ] 

     Set Variable [ $who; Value:Clients::ClientID ] 

     Go to Layout [ “Order” (Order) ] 

     New Record/Request 

     Set Variable [ $who; Value:"" ] 

End If

Here, apply the $who to the autoenter option of the foreignkey field in the order layout/table.

--sd

Link to comment
Share on other sites

But perhaps using the script parameter to convey the value is more obvious?? If not a button'ed script call, use a recursion in the script to pick it up. The variables method first really shines when several foreign keys needs transfere!

--sd

Link to comment
Share on other sites

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