I’m trying to use 2 @for loops in 1 field to send some emails.
How do i make the loop reset after it runs through the first time? Say i have 3 VP’s that each have 4 employees. I want the loop to go though the first VP and email each employee, Then i want it to move onto the second and email those employees, so on and so on.
The problem i have is the loop works but then when it moves to the second VP it is combining the first one’s employees also, then the third…
Post your code – there’s no way to tell what you’re missing. The problem’s not difficult, so the chances are pretty good that you’ve just made a small mistake.
act :=@If(@IsError(@DbLookup(“”:“”;“”:“”;“02 ENTER SALES READS STORE DATE TIME”;flag;6)); @Failure(“0”);@DbLookup(“”:“”;“”:“”;“02 ENTER SALES READS STORE DATE TIME”;flag;6));
act :=@If(@IsError(@DbLookup(“”:“”;“”:“”;“02 ENTER SALES READS STORE DATE TIME”;flag;6)); @Failure(“0”);@DbLookup(“”:“”;“”:“”;“02 ENTER SALES READS STORE DATE TIME”;flag;6));
Well, I can’t see how this formula is supposed to send different mails to different people, but I CAN see that you are never resetting the value of the “html” variable to “”, so the one person who is receiving mail will see a slightly longer message each time. That’s not the only problem, though. Never do this:
You are doing the same lookup twice. Yes, it’s cached THIS TIME, but it’s a bad habit because you’re going to wind up doing it with a nocache lookup some day. Do this instead:
Note that there is no @Failure in there. @Failure has meaning ONLY in field validation formulas (it does an @Prompt([OK]) and stops the UI save request). Don’t use @Failure anywhere else.
And variable[index] means the same as @Subset(@Subset(variable; index);-1). There’s no reason to use both and @Subset in the same statement.