Focal Point
[SOLVED] toDate Function in DQS - change return Format

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/2777056676

June 10, 2015, 03:57 PM
al*b*sure
[SOLVED] toDate Function in DQS - change return Format
When using the toDate function in Data Quality Suite, i am not seeing a way to control the return format. No matter what format you pass into the function ie: toDate('2014.7.14','yyyy.M.d') or toDate('JUL-2014','MMM-yyyy') or toDate('07/14/2014','MM/d/yyyy')

It will always return the date back in the "Day" format of yyyy-MM-dd (ie: 2014-07-14). Is there any way to change this to still return a date, but in the format we prefer?

I am using this in the Column Assigner step, on a field with a datatype of "Day". Maybe that's why i can't control it?

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.6
Windows, All Outputs
June 11, 2015, 07:51 AM
CraigSanders
ToDate coverts a string to a Date type. To format the output of the Date object use toString(yourDate,'yyyy-MM-dd') to return a String representation -- where the 'yyyy-MM-dd' is using Java's SimpleDateFormat syntax.

See below for details on Java SimpleDateFormat:
http://docs.oracle.com/javase/...impleDateFormat.html

Let me know if this helps..

Sincerely,
Craig Sanders
Integrity Solutions Product Manager - DQS/MDS
Information Builders Inc


all things iWay
June 11, 2015, 10:17 AM
al*b*sure
Thanks Craig, its what i suspected, and your reply makes sense. The plan that i created was for a profile, utilizing the Profiling step. I have a field defined as a rollup column and i am passing a string as 'JUL-2014', 'MMM-yyyy' format. The issue i was having was i purposely converted it to a date (using toDate) so that i could order it in my rollup by date. Right now, since its a string, systematically when the fields are rolled up, its in character form and ordered as such in the profile, so 'AUG-2014' comes before 'JUL-2013'. I was trying to think of a creative way to order the strings in date format on a rollup field. If you have any suggestions, please let me know.


WebFOCUS 7.6
Windows, All Outputs
June 12, 2015, 07:53 AM
CraigSanders
Try adding an Alter Format where you create a new column.. You can name it whatever you want but in the expression add 'toDate(youStringColumnHere,'MMM-yyyy')'

Now in the profile use this new column instead of your original string date column and it should work.

Let me know how it goes.

Sincerely,
Craig


all things iWay
June 16, 2015, 02:41 PM
al*b*sure
The information Craig gave me handled my issue.
[SOLVED]


WebFOCUS 7.6
Windows, All Outputs