Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

andreyfcdk91
Contributor

Strange result in script sorting

Colleagues, good day!

Working in QV script with order by operator show me some strange result when i try concat several fields.

I have one table:

 

Field1Field2Field3Field4
11A3
22B5
13B4
24B3
15B4
46D4
17D4
11A3
22B5
13B4
44f3
15s4
46D4
17D4

And i need to get final result by concat:

Test:

LOAD *

  

FROM

Sorting.xlsx

(ooxml, embedded labels, table is Лист1);

test2:

load

Field1&Field2&Field3&Field4

Resident Test Order by Field3, Field2, Field1;

DROP Table Test;

Result table must be:

 

11A3
11A3
22B5
22B5
13B4
13B4
24B3
15B4
46D4
46D4
17D4
17D4
44f3
15s4

Could anyone explain why sorting operator works so strangely?

Thanks.

1 Solution

Accepted Solutions
ahaahaaha
Honored Contributor

Re: Strange result in script sorting

And unload in QVD

Test:

LOAD *

FROM

Sorting.xlsx

(ooxml, embedded labels, table is Лист1);

test2:

load

Field1&Field2&Field3&Field4

Resident Test Order by Field3, Field2, Field1;

DROP Table Test;

Store * from test2 into xyz.qvd;

Result

1.jpg

Regards,

Andrey

7 Replies
ahaahaaha
Honored Contributor

Re: Strange result in script sorting

Hi Andrey,

In your internal table of all it is the way you want.

1.jpg

Settings object of sheet the (a simple table) give you a different view of the data.

Regards,

Andrey

andreyfcdk91
Contributor

Re: Strange result in script sorting

thanks, but my question was how to do it in load script, because final result must be save to qvd file.

Re: Strange result in script sorting

I think you are getting the result you are looking for...

Capture.PNG

I added a counter using RowNo() function


Test:

LOAD *

FROM

Sorting.xlsx

(ooxml, embedded labels, table is Лист1);

test2:

LOAD RowNo() as RecNo,

  Field1&Field2&Field3&Field4

Resident Test Order by Field3, Field2, Field1;

DROP Table Test;

andreyfcdk91
Contributor

Re: Strange result in script sorting

Thanks, but in qvd i need to store only Field1&Field2&Field3&Field4  without RecNo.

Will it save sorting?

ahaahaaha
Honored Contributor

Re: Strange result in script sorting

And unload in QVD

Test:

LOAD *

FROM

Sorting.xlsx

(ooxml, embedded labels, table is Лист1);

test2:

load

Field1&Field2&Field3&Field4

Resident Test Order by Field3, Field2, Field1;

DROP Table Test;

Store * from test2 into xyz.qvd;

Result

1.jpg

Regards,

Andrey

Re: Strange result in script sorting

I think it should... I don't see why it wouldn't

andreyfcdk91
Contributor

Re: Strange result in script sorting

Thanks.

Of course, it works correctrly in the end of load..

I forgot to uncheck standard A-Z sorting in stright table

Thanks!