BigG wrote:Hi, I have a employee list with emp number as the element name and two aliases, one emp number and name (which is always unique) and another just name (which does have duplicates). I have tried to recognise during attribute (alias) updates the duplicate 'names', but my IF statement below only works if I run the process once, If I was to reload the process will then all employee names are now not unique because they are in an element alias, therefore a concatenate occurs to make it unique...
Anyone have any further ideas?
Code: Select all
If( DIMIX('Employee',vEmployee_Name )>0);
ATTRPUTS(vEmployee_Name|' - '|vEmployee_No,'Employee',vEmployee_No,'Description');
else;
ATTRPUTS(vEmployee_Name,'Employee',vEmployee_No,'Description');
Endif;
I'm assuming that the names can change, since women who get married still sometimes change their name and the like. (If that wasn't the case you could just do the DimIx on the number + name alias and ignore anyone who showed up.)
However since we do have that complication, one way is as follows:
(a) Use the DimIX to get the index before you hit the If block, and store it in a variable.
(b) If that's >0, then use DimensionElementPrincipalName to get the employee number that the row relates to, and store that in a variable too. This will get you the employee number of the element which already has that employee name. (Otherwise set that variable to an empty string.)
(c) The If block test then becomes IF the DimIX value = 0 then write it to description (since it doesn't exist yet), ELSE IF DimIX > 0 & the element's principal name @<> the vEmployee_No (meaning that it's a different employee), then write the expression that you currently have under the If.