I almost have this; but can't seem to get it generated in a JSL script. The formula editor is doing almost exactly what I want... but when attempting to do it in a script... I can't seem to get it to work.
Desired result is in column 2; I apply the formula shown in the column editor to get the desired result.
//This is what I input into formula editor and it works fine;
item_lst = Words( Substitute( :Input, "/", "/;" ), ";" );
result_str = "";
For( i = 1, i <= N Items( item_lst ), i++,
If( item_lst[i] == "/",
result_str = result_str || "N",
result_str = result_str || "Y"
)
);
result_str;
When I try to create a new column within a JSL script and the I get the result in column 3. I seem to be nesting incorrectly and I can't seem to find this...
Here is the jsl code. Any help would be much appreciated.
da = Current Data Table();
da <<New Column("Keystring", Character );
:Keystring << Set Formula (item_lst = Words(
Substitute(:Input,
"/", "/;"
),
";"
));
result_str = "";
For( i = 1, i <= N Items( item_lst ), i++,
If( item_lst[i] == "/",
result_str = result_str || "N",
result_str = result_str || "Y"
)
);
result_str;