Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have data in the following manner, the request to load only value for the max (modified date) or latest modified date.
Please let me know if any suggestions.
Hi,
First load the table and then take max(modified_Date) and store that field in the vaiable using peek function.
and then you load the original script and use where condition modified_date=$(variable).
Then you will get max date data in your script.
I tried this way but giving blank value for other fileds except primary key.
Hi,
Cross check the data format in where condition
@Raju_6952 how about this?
mytable: Load *, Modifieddate From <<YourTable>>; minmax: LOAD min(Modifieddate) as MinDate, max(Modifieddate) as MaxDate RESIDENT mytable; LET vMinDate = peek('MinDate'); // This is to capture the minimum date LET vMaxDate = peek('MaxDate); // This is to capture the maximum date DROP TABLE minmax; Final_mytable: NoConcatenate Load * Resident mytable where Date(Modifieddate)=Date('$(vMaxDate)'); |
Hi @Raju_6952 ,
Try this :
DateMap:
Mapping load *;
Load PrimaryKey,max(date(date#(ModifiedDate,'DD.MM.YYYY'))) as Max
Resident Data group by PrimaryKey;
Noconcatenate
Final:
Load *
Resident Data where date(date#(ModifiedDate,'DD.MM.YYYY'))=Applymap('DateMap',PrimaryKey,'N/A');
Drop table Data;
Regards,
Rohan.
@Raju_6952 When you say no use, IS this you mean failed? or, Data not coming as expected or what is exact issue?
@Raju_6952 Please share sample dataset and expected result?