Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Talend Data Mapper and Date Handling (Comparison, Max, Min)

Hello,
I am trying to use the Talend Data Mapper at a client who wants to parse a loop date element and use the maximum and minimum.
I thought that simply using AgMaximum and AgMinimum functions could do it, but after getting errors and reading online help.
- It seems these functions take as argument (and return) only Decimals.
- Date/Time functions don't convert date to decimal/Integer or the other way around.
Now, I am blocked.
Would you then know a way to get the earliest and latest date in a looping date Element using the Talend Data Mapper ?
If not, if I must use an external XMLMap, would you recommend a way to pass simply the looping element out of the Mapper ?
Thanks,

Labels (3)
2 Replies
Anonymous
Not applicable
Author

Hi mhassine,
Can you set the input date array as type "String"?
Per my test, AgMinimum/Max can be applied to String loop and can return a String as well.
Example:
Input-->
...
<STR_DATES>
<STR_DATE>20140301</STR_DATE>
<STR_DATE>20130308</STR_DATE>
<STR_DATE>20121201</STR_DATE>
<STR_DATE>20140131</STR_DATE>
<STR_DATE>20140401</STR_DATE>
</STR_DATES>
...
-->Map-->
/min_date = AgMinimun(/str_dates/str_date);
/max_date = AgMaximun(/str_dates/str_date);
-->Output
...
<MIN_DATE>20121201</MIN_DATE>
<MAX_DATE>20140401</MAX_DATE>
Rgds
Yi
Anonymous
Not applicable
Author

Hello Yiliu,
Thanks for the answer, but for me, it doesn't work : I have this kind of error :
14578: Error - The specified value cannot be converted to the specified type. (307) (INPUT)
Reason - Converting: String -> Number Category
Value: 2013-03-28
Map: /LBBW/Maps/Leg_Map.xml - Map Element: in$/ndm_message/message/deal/inst/Anonymous_choice/derivative/Anonymous_choice/swap/pay_side_list/leg/period_list/period/adj_start_date
Line: 647 column: 37
For the record, I use the Data Mapper provided with Talend Platform for Data Services with Big Data 5.4.1.
This solution would however not be very nice since I have to define the XML Schema using a provided XSD file, that I am not supposed to modify.
However, my source dates are already sorted, so maybe is there a way to select the first occurrence and the last one, instead of using the AgMaximum and AgMinimum functions ! I didn't yet find this kind of solution.

Actually, I was trying to do it using Data Mapper but I figured, since I have to put the data in a DB afterwards, I could just send that as is into an tXMLMap, get a DI flow with one line for each date, then use a tAggregateRow, I would have the same result at the end.
However, if there is a solution with Data Mapper I would be glad to get it since it would look very nice to the customer !
Thanks !