For loop question

Hi Folks,

This is the simplified code of what I am trying to do. I would think I would get a return of “not blank” : “blank” : “blank” : “not blank”. All I am getting is “blank”.

Can anyone tell me what I am doing wrong here?

Any help would be appreciated.

Thanks,

Patti

signatures:=“Fred Flintstone” : “Daffie Duck” : “Porky Pig” : “Elmer Fudd”;

commentnames:=“Fred Flintstone”:“Elmer Fudd”;

@For(n:=1; n<=@Elements(signatures); n:=n+1;

Elementinlist:= @Member(signatures[n]; commentnames);

Commentlinks:= @If(Elementinlist =0; “blank”; “not blank”)

);

Commentlinks

Subject: For loop question

I agree with Ben that you probably intended to create a list. Try using this formula for Commentlinks, which will add a new value to the list with each iteration of the For loop.

Commentlinks:= @Trim(Commentlinks:@If(Elementinlist =0; “blank”; “not blank”))

Subject: RE: For loop question

Thanks to all of you for responding. I wasn’t thinking. I was overwriting my variable. It works with your recommendations.

Thanks,

Patti

Subject: For loop question

Hi, you’re obtaining the last value of your loop, try to put the values somewhere elese while looping.

put this code in a button to see the result of your code…

signatures:=“Fred Flintstone” : “Daffie Duck” : “Porky Pig” : “Elmer Fudd”;

commentnames:=“Fred Flintstone”:“Elmer Fudd”;

@For(n:=1; n<=@Elements(signatures); n:=n+1;

Elementinlist:= @Member(signatures[n]; commentnames);

Commentlinks:= @If(Elementinlist =0; “blank”; “not blank”);

@Prompt([OK];“”;Commentlinks)

);

Subject: For loop question

Don’t you want “CommentLinks” to be a list though? With each iteration of the loop, I think your code just over-writes CommentLinks, it doesn’t add to it. I could be wrong though, it’s late :wink:

HTH