Combining list elements, kinda

Hi guys,

I’m trying to figure out a way in @commands to combine a list with itself…

So if field BLAH has “A” : “B” : “C” : “D” in it, I want to compute another field so it has “A” : “AB” : “ABC” : “ABCD”

or if field BLAH has “A” : “B” : “C” in it, it would compute as “A” : “AB” : “ABC”

Cheers

Ad

Subject: Combining list elements, kinda…

How about …

List := “A” : “B” : “C”;

NewList := “*”;

@If(@Elements(List) > 1;

@Do(

  @For(n := 1;

     n <= @Elements(List);

     n := n + 1;

     NewList := NewList : @Implode(@Subset(List; n); ""));

  NewList := @Subset(NewList; 1 - @Elements(NewList))

);

NewList := List

);

@Prompt([OK]; “Result”; @Implode(NewList; " : "))

HTH,

Rob

http://www.inter-weavers.com

Subject: RE: Combining list elements, kinda…

or a bit simpler …

List := “A” : “B” : “C” : “D”;

NewList := @Subset(List; 1);

@If(@Elements(List) > 1;

@For(n := 2;

  n <= @Elements(List);

  n := n + 1;

  NewList := NewList : @Implode(@Subset(List; n); "")

);

“”);

@Prompt([OK]; “Result”; @Implode(NewList; " : "))