hcl-bot
December 27, 2007, 6:11am
1
Hi
I have a field on a form with the following formula:
Rol := “Manager”;
i := 1;
@For (n :=1; n<=@Elements(AllMembersRole); n:= n + 1;
@If (@Contains (AllMembersRole[n]; Rol );
full[i] := AllMembersRole[n];
full);
i := i + 1);
full
on the same form there is another field( multi value) called ‘AllMembersRole’. The value of the field looks like:
“Plant X~[Manager]”
“Plant Y~[HR]”
“Plant Z~[Manager]”
“Plant A~[PZ]”
“Plant Y~[PZ]”
“Plant B~[HR]”
“Plant Z~[Manager]”
According to the formula in the first field the value of the first field should have 3 items. But the field remains empty.
What is worng with the formula language I use?
Regards
hcl-bot
December 27, 2007, 7:47am
2
Subject: Formula in field returns empty value
You can read an array-element in formula language with full[i], but you cannot set it.
Change
full[i] := AllMembersRole[n]
to
full := full: AllMembersRole[n]
And since the 1st value in full will be an empty string, change the last line to
@trim (full)
Regards,
René
hcl-bot
December 27, 2007, 8:40am
3
Subject: RE: Formula in field returns empty value
HI
Thank you for the tip. I have changed the code like you said. But now the first item is allways double iin the list. Do I need to filter the unique items also? or is the code still not complete?
Regards
hcl-bot
December 27, 2007, 9:02am
4
Subject: RE: Formula in field returns empty value
This is what I’ve got:
Rol := “Manager”;
i := 1;
@For (n :=1; n<=@Elements(AllMembersRole); n:= n + 1;
@If (@Contains (AllMembersRole[n]; Rol );
full := full: AllMembersRole[n];
full);
i := i + 1);
@trim (full)
and it results in:
Plant X~[Manager]; Plant Z~[Manager]; Plant Z~[Manager]
So i don’t get a double value first. Plant Z is double, but that is also double in the fieldvalues you gave…
If you want to be absolutely sure that all values are unique you could use @unique :
@unique (@trim (full))
hcl-bot
December 27, 2007, 9:27am
5
Subject: RE: Formula in field returns empty value
HI
Thank you once again. Now I see only the unique items.
Kind Regards