Use @SetDocField to update multiple documents
Posted on 2014-01-22
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
@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?