5 Replies Latest reply: Oct 15, 2013 10:29 AM by Antoine Frangieh

# Rotate value in field

Hello,

Suppose I have the following:

A, B

1, a1;b2;c3;d4;e5

2, g6;h7;i8;j9;k10

]

;

Is there a function that allows me to obtain

A, B,

1, e5;d4;c3;b2;a1

2, k10;j9;i8;h7;g6

]

I have used subfield(B,';'), expanded, added a counter, reversed the order and recombined.

Is there any faster way to do this?

Kind regards,

Antoine

• ###### Re: Rotate value in field

Solved here..

http://community.qlik.com/message/95968#95968

edit/ partially, unsolved

• ###### Re: Rotate value in field

I hope there is no other faster way.

Is the number of values is fixed (i.e., e;d;c;b;a is 5. is it same for all?)

• ###### Re: Rotate value in field

Lol...

No the length is variable unfortunatly.

It seems that I can create a custom function to do so.

I am not familiar of creating a custom VBS script and then using it in the load script.

EDIT: Got it. I add it in the VBS script, run the script and then call it within the script.
Quite amazing !!!! this is Gold

• ###### Re: Rotate value in field

Still I have a complete reverse

now i need to figure out how to finetune...

• ###### Re: Rotate value in field

This snippet worked:

Function reverse(t)

r = " "

For i = 1 to ((len(t)-1)/2) step 1

r = r & mid(t,(len(t) - i*2),2)

next

reverse = r

end Function

• ###### Re: Rotate value in field

It is not stable

I keep getting variable results for every reload.

I don't understand why...

has anyone experienced instability using a VB script within the load statement?