Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi every one,
suppose I have a field named AAA:
AAA
[139401,
139402,
139403,
139404,
139410,
139511]
I want to separate 2 numbers from the right of all this field values, in another word, I need to have toe field of AAA1 and AAA2:
AAA1
[1394,
1394,
1394,
1394,
1394,
1395]
and AAA2
[01,
02,
03,
04,
10,
11]
As I need to use tow variables of AAA1 and AAA2 in different calculations, so I think that I must use some functions on the script!
I would appreciate it if some one can help me.
Thank you in advance,
Zahra
You can use a SubField() function:
For example if you have 1394|01 you can split it by doing this:
SubField('1394|01', '|', 1) -> 1394
SubField('1394|01', '|', 2) -> 01
HTH
Best,
Sunny
Dear Marco Wedel,
Thank you a lot for your creative and helpful answer.
Best regards,
zahra
All the answers are helpful and correct!
Now which of these must be mark as correct answer?
I think it doesn't matter, just randomly choose one as correct answer and reward others by marking there answer as helpful answer
Ok, I will do that!
Dear sunny,
If I have some data like below:
1394/01
1394/03
1395/10
...
.
I want to separate '01' , '03' , ..., so I use these functions:
table1:
load A,
subfield (A, '/', -2) as a1,
subfield (A, '/', -1) as a2,
from....
But it does not show a2 !
It does not show a2? what do you mean?
Can you try this:
table1:
load A,
subfield (A, '/', 1) as a1,
subfield (A, '/', 2) as a2,
I wrote that as you wrote but If I use "," or ";" after "subfield (A, '/', 2) as a2" it shows error and rest of the sentence ( from.....) begin red not blue!
and if I omit the signs, it works but shows dashes for a2 values!
I was not sure if you have more fields after a2 or not, but if you don't then do this:
table1:
load A,
subfield (A, '/', 1) as a1,
subfield (A, '/', 2) as a2
FROM source;