Formula and List Kings - Watch that!

dear all,

what I want to have as output:

my title (field _title)

my name (field _name)

category 1 (field list_categories)

topic 1 (field my_entries)

topic 3 (field my_entries)

category 2 (field list_categories)

topic 4 (field my_entries)

topic 2 (field my_entries)

and so on.

field _values_1 as list => category1##category2##category1##category2

field _values_2 as list => topic3##topic2##topic1##topic4

you see what i need?

what i did:

list_categories := “category1”:“category2”:“category1”:“category2”;

my_entries:=“topic3|category1”:“topic1|category1”:“topic2|category2”:“topic4|category2”;

“generate an output list which is large enough and contains the heading of the category”;

output:=@Explode(@Implode(list_categories;“;”);“;”);

“step through all topics and …”;

@For(i:=1;i<=@Elements(my_entries);i:=i+1;

"....and check to which category they belong to";

@For(k:=1;k<=@Elements(list_categories);k:=k+1;

		"found the match? FINE! add it to the output list";

		@If(@right(my_entries[i];"|") = list_categories[k]; output[k]:=output[k]+my_entries[i];"")

	)

);

"if nothing goes wrong output should look like this at ";

“output[1] => category1topic3topic1”;

“output[2] => category2topic2topic4”;

output

BUT: output is always category1; category2; category1; category2

what am i doing wrong?

please help me with this…i’m frustrated :-/

alex

Subject: Try this…

Hi Alex,

The following should give you the list you are looking for…

list_categories := “category1”:“category2”;

my_entries := “topic3|category1”:“topic1|category1”:“topic2|category2”:“topic4|category2”;

output := “”;

@For(i:=1; i<=@Elements(list_categories); i:=i+1;

output := @Trim(output : (list_categories[i] + @Implode(@Trim(@Left(my_entries; ("|" + list_categories[i]))))))

);

regards

Darren.