Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
skumarqv11
Contributor III
Contributor III

Sort order in currenet selction box?

Hi guys,

I loaded with 3 columns like below.

Temp:
LOAD Today() as Day,
ReloadTime() as Reloadtime,
monthend(today()) as Month_End
AutoGenerate 1;

When I select these values in the UI Part(TableBox), By default it shows the Order in current selection like below(i.e. How it has loaded in the script) .

But i need to show them in order like Month End,Day and Reloadtime. Can we achieve this as we don't have sort option in the Currenet selection box????

6 Replies
swuehl
MVP
MVP

Maybe use an alternative to the current selection object, without double-checking, I think you should be able to control the sorting

Current Selection Alternatives

prieper
Master II
Master II

You need to change the loadorder in the script.

This can be achived with a kind of dummy table:

Dummy:

LOAD NULL() AS Month_End, NULL() AS Day ..... AUTOGENERATE 0;

now comes a phantastic script ...

DROP TABLE Dummy;

Such kind of Dummy-Table may also contain the formattings, which then will automatically handed over to the field-properties ....

skumarqv11
Contributor III
Contributor III
Author

Hey thanks for your input, its not working for me.

I am using the below code. still facing the same issue.

Temp:
LOAD '' as Flag,
Today() as Day,
ReloadTime() as Reload_Time,
monthend(today()) as Month_End
AutoGenerate 1;


Temp1:
LOAD null() as Month_End,
null() as Day,
null() as Reload_Time
AutoGenerate 0;

drop table Temp1;

prieper
Master II
Master II

Such temporary table may be loaded in the very beginning of the script (and then deleted at the end)

edit: sample script attached:

Dummy: LOAD

    NULL()            AS Dim3,

    NULL()            AS Dim2,

    NULL()            AS Dim1

AUTOGENERATE 0;

Characters:

Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;

ASCII:

Load

if(RecNo()>=65 and RecNo()<=90,RecNo()-64) as Num,

Chr(RecNo()) as AsciiAlpha,

RecNo() as AsciiNum

autogenerate 255

Where (RecNo()>=32 and RecNo()<=126) or RecNo()>=160 ;

Transactions:

Load

TransLineID,

TransID,

mod(TransID,26)+1 as Num,

Pick(Ceil(3*Rand1),'A','B','C') as Dim1,

Pick(Ceil(6*Rand1),'a','b','c','d','e','f') as Dim2,

Pick(Ceil(3*Rand()),'X','Y','Z') as Dim3,

Round(1000*Rand()*Rand()*Rand1) as Expression1,

Round(  10*Rand()*Rand()*Rand1) as Expression2,

Round(Rand()*Rand1,0.00001) as Expression3;

Load

Rand() as Rand1,

IterNo() as TransLineID,

RecNo() as TransID

Autogenerate 1000

While Rand()<=0.5 or IterNo()=1;

Comment Field Dim1 With "This is a field comment";

DROP TABLE Dummy;

skumarqv11
Contributor III
Contributor III
Author

Thanks its working fine, but i am facing the formatting issues. how we can handle this. we can able to do that in the table box but its not showing in the current selection box.

prieper
Master II
Master II

Either you do the formatting in the Document-Settings, or you modify the code with some formatting-info:

  1. Dummy: LOAD
  2.    DATE(TODAY(), 'M/D/YYYY'  )          AS Month_End,
  3.    DATE(TODAY(), ''M/D/YYYY' )           AS Day,
  4.    TIMESTAMP(TODAY(), ''M/D/YYYY hh:mm' )           AS Reload_Time
  5. AUTOGENERATE 0;

edit: Line 4 modified to Timestamp