onederwomyn
asked on
Need Help Using DbLookup where key is multivalue field
Hi all. I need help doing a DbLookup to get a MailSend to work correctly. Essentially, I have a field containing 3 plants. 1 plant can be chosen, or all 3 plants can be chosen. The field to choose these plants is a db lookup first column and they just checkmark the ones that apply.
Well, each plant has a list of people that need to be emailed if that plant is chosen. This is column 2 of the view. If just one plant is chosen, it is a no brainer and works fine. However, if 2 or more plants are chosen, the lookup to grab the names from that second column isn't working.
Here is my code:
@MailSend(@DbLookup( "" : "" ; "" : "" ; "Directors";signofffrom; 2) where signofffrom is the name of the field containing one to three plants. I am trying to use it as the key thinking it would look up each individually. I thought wrong, huh?
So, long story short, how can I look up multiple values using DbLookup?
Well, each plant has a list of people that need to be emailed if that plant is chosen. This is column 2 of the view. If just one plant is chosen, it is a no brainer and works fine. However, if 2 or more plants are chosen, the lookup to grab the names from that second column isn't working.
Here is my code:
@MailSend(@DbLookup( "" : "" ; "" : "" ; "Directors";signofffrom; 2) where signofffrom is the name of the field containing one to three plants. I am trying to use it as the key thinking it would look up each individually. I thought wrong, huh?
So, long story short, how can I look up multiple values using DbLookup?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I used this as a base with a slight modification
Thanks!!
Could you let us have a peek at that "slight modification", if it was essential to the case?
Could you let us have a peek at that "slight modification", if it was essential to the case?
If using R7+ then you could put the @dblookup within a @for loop that gets each element of the signofffrom field.
Rough example
personlist:="";
@for(n:=1;
n<=@elements(signofffrom);
n:=n+1;
personlist:=personlist+@db
);
@MailSend(personlist);