Link to home
Start Free TrialLog in
Avatar of Michael Purdham
Michael PurdhamFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Use @SetDocField to update multiple documents

I have a database with 3 forms Company, Contact & Activity.
Contact & Activity are not responses.
I have built a hierarchy using @Unique for field CoUNID and this is inherited first into a Contact is composed from the Company inheriting CoUNID and other field values.
Activity is composed from the Contact inheriting CoUNID, ConUNID and other field values.

I have a number of critical field values in the Company e.g Company Name (CoName) that need to be updated in the associated Contacts and Activities if the user changes the value in the Company.

I save these values as a list to a field in the Company and when the user saves the Company, if any have changed update the Contacts and Activities using @SetDocField and @DbLookup to return the documentUNID

DocUNID:=@DbLookup("Notes":"NoCache";"":"";"LupContactsByDocUNID";CoUNID;2);
@SetDocField(DocUNID; "CoName"; CoName);

This works fine as long as there is only one Contact. If there is more than one only the contact with the first documentUNID is updated.

How do I change this so that all documents with matching CoUNID returned by the @DbLookup are updated?
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michael Purdham

ASKER

Thanks Sjef

@Transform works great!

@Transform(  list  ;  variableName  ;  formula  )

DocUNID:=@DbLookup("Notes":"NoCache";"":"";"LupContactsByDocUNID";CoUNID;2);

@Transform( DocUNID  ;  "DocUNID"  ;  @SetDocField(DocUNID; "CoName"; CoName));