Discussion Board for collaboration on QlikView Scripting.
attached is a sample data file (is a personal/desktop) edition.
The output i want to obtain is the following:
if field3 = 1, the first 5 number of field4 and the last 2 of the same field.
field3 is not in table, so i use applymap function.
Can someone help me?
Is this your expected output?
thanks for the message.
No, only in record with field2 01700000, o1600000 and ps000000 i want to see the value in new_field.
Because only in these record field3 = 1.
If(ApplyMap('KEY_TO_FIELD3',[FIELD2],'n/a')=1, (Left([FIELD4],5) & ',' & Right([FIELD4],2))) as NEW_FIELD;
Yes, i've tried this expression and it works.
But, field3 in my file has been imported from a txt file.
The script is something like: [@18:20] as field3 and in the straight table i not see "1" but "001".
I think it probably be a problem of format but i don't know how to solve it!
001 is a text value here. You could get 1 from it using num(). Remove comma and try like:
If(ApplyMap('KEY_TO_FIELD3',[FIELD2],'n/a')=1, Num(Left([FIELD4],5) & Right([FIELD4],2))) as NEW_FIELD;
Sorry, but i don't understand the solution.
Now, in my file, new_field is correctly calculated.
The thing that is wrong is that the sw probably don't recognize that i want to see this value only in the records that have field3 = 1 !