Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for
Did you mean:
Not applicable

## How can I split some part of numbers of a field?

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.

Zahra

1 Solution

Accepted Solutions
MVP

Try this:

Table:

Left(AAA, 4) as AAA1,

Right(AAA, 2) as AAA2;

AAA

139401,

139402,

139403,

139404,

139410,

139511

];

Output

28 Replies
Anonymous
Not applicable
Author

hi,

left(ÁAA,4) as AAA1

mid(AAA,5) as AAA2

or

Right(AAA,4) as AAA2

Regards

Neetha

MVP

Try this:

Table:

Left(AAA, 4) as AAA1,

Right(AAA, 2) as AAA2;

AAA

139401,

139402,

139403,

139404,

139410,

139511

];

Output

MVP

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

Creator III

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)

left(AAA,4) as Date_Year,

mid(AAAA,5,2) as Date_Month,

Right(AAAA,2) as Date_Day,

From ...

Best Regards,

Not applicable
Author

Hello Zahra,

Hope this thing helps you out.

Main:

Load *,Left(AAA,4) as AAA1, Right(AAA,2) as AAA2;

AAA

139401,

139402,

139403,

139404,

139410,

139511

];

Thank you

MVP

‌Another solution for integer values only:

Mod(AAA,100) as AAA2

Div(AAA,100) as AAA1

regards

Marco

MVP

Very creative MarcoWedel

Not applicable
Author

Dear neetha,

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

Not applicable
Author

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

Community Browser