Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

RE : SORT ORDER

   Hi All,

I have a field which is a combination of dates(ie..20130812,20121001,20121003). the requirement is i need to make separate fields from this field in the descending order of dates.

EG.

.field-1 as 20130812

filed-2 as 20121003

filed-3 as 20121001

like this...

how can it be achieved??

please suggest..

thanks in advance../

12 Replies
Master II
Master II

can you explain more, please

the fields are in a record?

Master II
Master II

Separate fields in year, month and day?

left(field, 4) as year,

mid(field, 5,2) as month,

rigth(field, 2) as day

Hi,,

try below

load *,SubField(Test,',') as Test1;

load * Inline

[

Test

"20130812,20121001,20121003"

]

Regards

ASHFAQ

Hi

Try like this

I think your date is in text format..

Date(Date#(DateField, 'YYYYMMDD')) AS Date

After that display as in descending order by using Sorting tab.

Edit:

If you need to separate the field values ., try with SubField() functions.

Ex:

SubField(DateField,',')

Thanks & Regards,
Mayil Vahanan R
Not applicable

Hi..

The Main field contains the values like ie..20130812,20121001,20121003 (This is 1 value of the filed like this there are 'n' no of records) these are all dates in YYYYMMDD format.it doesn't have any order as ascending or descending.


Requirement:

need to make 3 Sub fields according to the descending order of dates

here for this value it will be

Subfield 1 : 20130812 (max date)

Subfield 2 : 20121003(max-1 date)

Subfield  3 : 20121001 (Max-2 date)

Hi,

did you try my suggestion.

Can you post sample data with 5-10 records with expected output.

Regards

ASHFAQ

Or you need something like this.

load *,SubField(Test,',') as Test1,

SubField(Test,',',1) as Test2,

SubField(Test,',',2) as Test3,

SubField(Test,',',3) as Test4;

load * Inline

[

Test

"20130812,20121001,20121003"

"20130812,20121001,20121003"

]

Regards

ASHFAQ

Not applicable

hi..

Thanks for the reply..

as you said we can separate the fields using subfield and date functions can be applied.

But i need to make the subfield according to the descending order of dates.

How it will be possible??

pls suggest...

Thanks

Reena

Hi

I think, need to use macro in script to rearrange the dates before use the subfield function.

Thanks & Regards,
Mayil Vahanan R