Newbies dedalo Posted September 11, 2012 Newbies Posted September 11, 2012 Hi, I need to write a script that (based on a unique key defined by user in a field of the current record) copy a field from the record that match the key in the same field in the current record. E.g.: I have a table "Contracts", the user is inserting a new contract, he choose another contract by a self-relationship of the table "Contracts" and my script have to copy the field "PaymentMethod" from the other contract in the current contract. This is only an example to simplify the understanding, the real problem is more complex. Thanks in advance.
doughemi Posted September 11, 2012 Posted September 11, 2012 How about Set Field[PaymentMethod; SelfJoin::PaymentMethod] Note that this method requires that one of the predicates in the selfjoin relationship is Contracts::ID ≠ SelfJoin::ID.
comment Posted September 11, 2012 Posted September 11, 2012 he choose another contract by a self-relationship of the table "Contracts" If you have a self-join relationship of the Contracts table, then all the data from the related record is available through that relationship. Not sure why you would need to copy it. Note that this method requires that one of the predicates in the selfjoin relationship is Contracts::ID ≠ SelfJoin::ID. I am not sure of that - I think it depends on what the self-join relationship is based upon.
Recommended Posts
This topic is 4525 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 accountSign in
Already have an account? Sign in here.
Sign In Now