Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to change the order of values in the field in script level

hi,

I am having a filed which consists of

Name

A

B

C

D

D

but i need get them in this order

A

B

D

F

E

can we do it in script level by using the apply map can anyone help me .

thanks in advance

12 Replies
Not applicable
Author

is its a limit set of data and you know the exact order ... first load a inline table with the same fieldname and order the data you wanted then load your actual table ,then delete the temp inline table. qlikview loads the data in same order as it loaded before. on chart you can use 'load order' on sorting options.

alexandros17
Partner - Champion III
Partner - Champion III

Take a look to dual(x,y) function, it is what you need

... let me know

Not applicable
Author

can you please provide me the script if possible

Not applicable
Author

TempTable:

load * inline

[

Fieldname

A

B

D

F

E

];

ActualTable
load * from abc..... ;

drop table TempTable;

Anonymous
Not applicable
Author

script:

//this is how your mapping table looks like and this is an example

MapDOW_master:

Mapping LOAD * INLINE [

    Day, Day of Week

    1, 1

    2, 2

    3, 3   

    4, 4

    5, 5

    6, 5

    7, 5

];

//In your main table your column script will be like this

applymap('MapDOW_master', CalendarDayoftheWeek))  as Daynumber....

Not applicable
Author

it worked for me.

if i take a list box it is showing in the order i need.

but i am combining 2 other fields and showing them in one multi box as selection.

TempTable:

load * inline

[

Fieldname

A

B

D

F

E

];

ActualTable
load * from abc..... ;

LOAD DISTINCT No,

              '1|' & [Name]  as Sort,

              [Name] AS Selec

RESIDENT Dim ORDER BY No ASC;

drop table TempTable;

this is what i am using

when i take the Selec filed into multi box and in the sort tab when i choose the options

it is not getting i am getting all the names in the alphabetical order

6-4-2014 12-01-57 PM.png

Not applicable
Author

i tried this method but it did not work in my case.

Not applicable
Author

sorry ... i dont get it. why are you using the sort field and using expression sort when you select load order ?

maxgro
MVP
MVP

some solutions

1) use this before loading the field (in any table): this is the load order you can set in sort tab

load * inline [

Name

A

B

D

F

E

];

2) recreate the field and use in sort tab load order

source:

load * inline [

Name

A

B

C

D

E

F

];

left join (source)

load Name,

match(Name, 'A', 'B', 'D', 'F', 'E', 'C') as FieldOrder

resident source;

rename Field Name to NameOrig;

final:

noconcatenate load

NameOrig as Name

Resident source

order by FieldOrder

;

drop field FieldOrder;

3) use dual and then sort the field in sort tab by Numeric Value (the second field= Sort)

load dual(Name, Sort) as Name inline [

Name, Sort

A,1

B,2

C,3

D,6

E,5

F,4

];