Issue with Words()Hi,
I have written the following code which functions as follows-
1.Check if column name EPATH exists in the table
2.If yes get all values of the column
3.Need to get the string after last "\" in the column value.
4.The code does work but appends "}" at the end of the value.
If( Contains( col_name ,"EPATH" ),
unique_epath = {};
unique_epath = Associative Array(dt:EPATH) << Get Keys;
wordlist=Words(char(unique_epath), "\");
totword=NItems(wordlist);
Column(dtout,"Order")[1] = wordlist[totword-0];
);
How can I get around this problem?
TIA
Re: Issue with Words()This works.Thank you!Re: Issue with Words()Is this what you are after?
NamesDefaultToHere(1);
dt = New Table( "Test",
Add Rows( 5 ),
New Column( "EPATH",
Character,
"Nominal",
Set Values( {"a\b\c", "a\b\c", "d\e\f", "d\e\f", "g\h\i"} )
)
);
unique_epath = Associative Array(dt:EPATH) << Get Keys;
lastPart = {};
for(p=1, p<=NItems(unique_epath), p++,
parts = Words(unique_epath[p], "\");
InsertInto(lastPart, parts[NItems(parts)])
);
Print(lastPart);