@Set into @Do : variables not set, I don't understand why?

Hi,

I try to set and use variables into @Do but it doesn’t work and I don’t understand why.

Formula below :

DestSansEmetteur := “”;

lstAdresseEmailTemp :=“”;

@If( BlahBlah !=“” ;

@Do(

	@Set("DestSansEmetteur";@Trim(@Replace(Destinataire;NomCreat;"")));

	@Set("lstAdresseEmailTemp";@Trim(@DbLookup("":"";"":"";"MailDestNouvDemande";DestSansEmetteur;2)));

	@If(lstAdresseEmailTemp ="" | @IsError(lstAdresseEmailTemp);@Return("");lstAdresseEmailTemp)

);

“”

)

DestSansEmetteur is set correctly but Dblookup don’t work ?

Could somebody help me?

Thank you,

Thierry

Subject: @Set into @Do : variables not set, I don’t understand why ??

Well, I’m sure the reason your dblookup isn’t working has nothing to do with the fact that you’re using @set, which is what your posting subject suggested to me. Have you tried all the usual suspects vis-à-vis the dblookup arguments; @dbname for the second argument, a literal value instead of the DestSansEmetteur variable for the key, and of course ensuring that the view is sorted correctly, named correctly, etc?

By the way, as long as you’re coding in R6, you don’t need to use @set anymore, ever; it’s now legal to use the assignment operator in a function argument and it’s also now legal to assign a new value to an existing variable using the assignment operator a second time in a second assignment statement without having to use @set for that, either. So your code could be written

DestSansEmetteur := “”;

lstAdresseEmailTemp :=“”;

@If( BlahBlah !=“” ;

@Do(

	DestSansEmetteur := @Trim(@Replace(Destinataire;NomCreat;""));

	lstAdresseEmailTemp := @Trim(

		@DbLookup("":"";"":"";"MailDestNouvDemande";DestSansEmetteur;2));

	@If(lstAdresseEmailTemp ="" | @IsError(lstAdresseEmailTemp); @Return(""); lstAdresseEmailTemp)

);

“”

)

Another new-in-R6 feature that you could use here is

lstAdresseEmailTemp := @Trim(@DbLookup(“”; “”; “MailDestNouvDemande”; DestSansEmetteur; 2; [FailSilent]));

@If(lstAdresseEmailTemp =“” | @IsError(lstAdresseEmailTemp); @Return(“”); lstAdresseEmailTemp)

Not that any of that changes anything about the way it works; your dblookup still won’t work, but it is a little neater, eh?

Subject: SOLVED! :@Set into @Do : variables not set, I don’t understand why ??

Hi Bruce,

Thank you very much, you are right

You opened my eyes…

Before including my formula in @Do I had tested it and it worked. All was correct, view too and I put my formula into @if(…@Do( and is that did not function more because, by inadvertency, I had modified the view and column 2 had disappeared, shame on me!

However before used forum, I had checked all…

Also, thanks for your advice about new R6 feature.

Have nice weekend,

Best regards,

Thierry