AnsweredAssumed Answered

GEL Syntax Question - Dynamically created variables

Question asked by Lowell on Dec 1, 2011
Latest reply on Nov 30, 2011 by fpena
Hi All,
I have 2 syntax questions:

1: How do I get the "length" of a string? For example, I am building an ID string with a number of characters from the Name until it is unique, but I need to know the length of the string first:
In Excel, I can do "=len(a1)" and you get "19" --- How do I do this in GEL?

2: I can dynamically create "variables", but I cannot seem to "reference them dynamically"...

<!--Set "count" recordnumber variable to create "multiple" variables-->
<core:set value="0" var="recordnumber"/>
<core:forEach begin="0" items="${dup3_dup.rows}" trim="false" var="dup4">

<!--Populate Variables with duplicates-->
<core:set value="${dup4.sdivid}" var="dup_rec_${recordnumber}"/>
<core:set value="${dup4.sdiv}" var="dup_recname_${recordnumber}"/>
<core:set value="0" var="dup_rec_yesno${recordnumber}"/>

Now, how do I reference the "dup_rec_${recordnumber}"?

These don't work:

What would work?

The reason I need to dynamically set variables is that I have "junk data" that comes in my system and I'm expected to "clean up duplicates" before I can process them. There are currently a small number of duplicates, but it is forseeable that the data will have many more duplicates. I am making this code completely expandable for all of their "junk data", so that I don't have to add a "case statement" to be able to reference any new values.