Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead 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.

Thank you in advance,

Zahra

28 Replies
Not applicable
Author

Dear Sunny,

That was what I exactly did!

table1:

LOAD Tari,

          Ta,

          Left(Tari, 4) as AA1,

          Right(Tari, 2) as AA2,

         SubField( Ta,'|', 1) as a1,

          SubField(Ta, '|', 2) as a2

FROM

(ooxml, embedded labels, table is Sheet1);

sunny_talwar

What error is it giving you when you are reloading it?

Not applicable
Author

Syntax error, missing/misplaced FROM:

table1:

LOAD Tari,

     Ta,

    

     Left(Tari, 4) as AA1,

          Right(Tari, 2) as AA2,

         SubField( Ta,'|', 1) as a1,

          SubField(Ta, '|', 2) as a2,

FROM

(ooxml, embedded labels, table is Sheet1)

table1:

LOAD Tari,

     Ta,

    

     Left(Tari, 4) as AA1,

          Right(Tari, 2) as AA2,

         SubField( Ta,'|', 1) as a1,

          SubField(Ta, '|', 2) as a2,

FROM

(ooxml, embedded labels, table is Sheet1)

sunny_talwar

Do you have ; after the last statement?

table1:

LOAD Tari,

    Ta,

  

    Left(Tari, 4) as AA1,

          Right(Tari, 2) as AA2,

        SubField( Ta,'|', 1) as a1,

          SubField(Ta, '|', 2) as a2,

FROM

(ooxml, embedded labels, table is Sheet1);

Not applicable
Author

Yes, I do!

sunny_talwar

My bad, remove the comma after a2

table1:

LOAD Tari,

    Ta,

 

    Left(Tari, 4) as AA1,

          Right(Tari, 2) as AA2,

        SubField( Ta,'|', 1) as a1,

          SubField(Ta, '|', 2) as a2

FROM

(ooxml, embedded labels, table is Sheet1);

Not applicable
Author

Yes, I do that but the problem is: it shows dashes for a2 !

swuehl
MVP
MVP

Your delimiter '|' doesn't match the delimiter in your sample data ('/')

1394/01

1394/03

1395/10

Seems something has changed. Please provide a current data sample.

Not applicable
Author

Dear