Solved

Use @SetDocField to update multiple documents

Posted on 2014-01-22
2
408 Views
Last Modified: 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

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.
0
Comment
Question by:kcoxon
2 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
ID: 39800603
If you're sure that the lookup returns all UNIDs, you can try with either an @For or an @Transform.
0
 

Author Closing Comment

by:kcoxon
ID: 39800909
Thanks Sjef

@Transform works great!

@Transform(  list  ;  variableName  ;  formula  )

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

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Novell released its latest version of GroupWise a few weeks ago.  The version is 2012 and it only runs on Linux (SUSE Linux Enterprise Server 10/11 is the first choice and I'm not sure about other Linux distributions, such as Red Hat, Debian, etc.) …
Regular maintenance of GroupWise Mailbox keeps it running flawlessly. Sometimes, it is also seen that mailbox maintenance is needed for resolving various issues of mailbox and other Novell GroupWise database. By using the ‘Repair Mailbox’ feature, a…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now