Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get max date from script depending upon current selection of calender date

Hello All,

I have Batch date from script but I want to pull latest date from script depending upon current selection. Please refer the following ex:

EX:

Header 1Header 2Header 3Header 4
MATNRKEYBatchDateQty
112322/1/201420
145618/2/201520
178924/4/201520

In above example : MATNR 1: I have 3 keys and 3 dates but with same qty. Now In calender I have selcted 2015 Apr.

So in that case I want only 1 row that is last row as it is nearer to my selection date.

How to handle this in script side only, so How to write a script for that.

15 Replies
Gysbert_Wassenaar

Current selections are not available during the load. So there are no current selections that can be used in the script.


talk is cheap, supply exceeds demand
Not applicable
Author

use below script it will give max date

load

MATNR,

Qty

max(BatchDate) as BatchDate resident table  group byMATNR,Qty;

and let me know if it is working or not or else provide data

Thanks

Manju

Not applicable
Author

cane we handle it in expression side

marcus_sommer

Another method to fetch the min/max value from a field: “Fastest” Method to Read max(field) From a QVD | Qlikview Cookbook.

- Marcus

NareshGuntur
Partner - Specialist
Partner - Specialist

Please check this and let me know if you have any questions.

Cheers,

Naresh

Not applicable
Author

It will work for irrespectiove of current selection.

It means in your solution it will give me 25 Apr 2015 but if i select Jan 2015 then in that case I want first record i.e,

22 Jan 2015

NareshGuntur
Partner - Specialist
Partner - Specialist

Did you try the document which I have given? It is working fine.

Cheers,

Naresh

Not applicable
Author

Hello Naresh,

I didn't get any document can you send it again.

NareshGuntur
Partner - Specialist
Partner - Specialist

Please check this