hcl-bot
November 27, 2008, 11:26am
1
Hi:
I have a list like this:
22T : 22V: 65T : 72T : 72V : 45T
What I want to do is do remove all elements that contain “V” and put the updated list into a dialoglist in a field. I’m trying to do it this way, where nonlocationcode is “V”:
sublist := @For (n := 1;n <= @Elements (list);n := n + 1;
@If (@Contains (list[n];nonlocationcode); @Replace (list; list[n];" “);”"));
but I get “Error: Keywords must be text!”
What am I missing on this?
Thanks,
Is
hcl-bot
November 27, 2008, 12:47pm
2
Subject: @For and List
I don’t this it’s the best solution, but it works for me.
@For (i := 1; i <= @Elements (fullList); i := i + 1;
@If (@Begins (fullList[i]; start);
@If (list = “”;
list := list + fullList[i];
list := list + “:” + fullList[i]);
“”)
);
list := @Explode (list; “:”);
I juste create a string and explode it at the end. It’s easy and simple.
I have not adapted it to your problem, but I think it’s what you want.
hcl-bot
November 27, 2008, 6:33pm
3
Subject: @For and List
Take a look at the @transform function. It does exactly what you want with a minimum of code.
list:=“22T” :" 22V": “65T” : “72T” :“72V” : “45T”;
@Trim (@Transform (list;“x”;@If (@Contains (x;“V”);“”;x)))
See the designer help for more info.
Regards,
René
hcl-bot
November 28, 2008, 1:44pm
4
Subject: RE: @For and List
That can actually be improved by using @Nothing instead of “” and @Trim :
@Transform (list;“x”;@If (@Contains (x;“V”);@Nothing ;x))
Subject: RE: @For and List
Thanks for the help! @Transform works perfectly! (Nice to hear from you Stan!)
hcl-bot
November 28, 2008, 8:35am
6
Subject: RE: @For and List
Yeah, your solution is must better then mine. Thanks.