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
Try this:
Table:
LOAD AAA,
Left(AAA, 4) as AAA1,
Right(AAA, 2) as AAA2;
LOAD * Inline [
AAA
139401,
139402,
139403,
139404,
139410,
139511
];
Output
hi,
Please try;
left(ÁAA,4) as AAA1
mid(AAA,5) as AAA2
or
Right(AAA,4) as AAA2
Regards
Neetha
Try this:
Table:
LOAD AAA,
Left(AAA, 4) as AAA1,
Right(AAA, 2) as AAA2;
LOAD * Inline [
AAA
139401,
139402,
139403,
139404,
139410,
139511
];
Output
Left(AAA,Len(AAA)-2) as AAA1,
Right(AAA,2) as AAA2
If it's always 2 characters at the end and a variable length of AAA is possible.
Hope this helps
Regards
Marco
Dear Zahra,
Please use left () and Right() and mid() function to separate different part the shamsi date like below:
if AAAA format is something like YYYYMMDD (13941205)
load*,
left(AAA,4) as Date_Year,
mid(AAAA,5,2) as Date_Month,
Right(AAAA,2) as Date_Day,
From ...
Best Regards,
Hello Zahra,
Hope this thing helps you out.
Main:
Load *,Left(AAA,4) as AAA1, Right(AAA,2) as AAA2;
Load * Inline [
AAA
139401,
139402,
139403,
139404,
139410,
139511
];
Thank you
Another solution for integer values only:
Mod(AAA,100) as AAA2
Div(AAA,100) as AAA1
regards
Marco
Very creative MarcoWedel
Dear neetha,
Thank you for your help.
I used these functions on the front end say in a table, so I could not use the created variables in another tables or charts.
best,
Zahra
Dear Sunny,
Thank you very much, I used mid () function on the front end but I could not use that on the script. Now I know where was my mistake!
I have another question that if there is a kind of separator, How can I split these two parts?
Regards,
zahra