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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Check if a string is a valid date pattern ?

Hi there,
I have a CSV File as a source, one of the field is supposed to be a date
But sometimes, some rows deliver this field with an invalid string for a date (for example : "378-35-23", or "NaN-NaN-NaN", etc ...)
I would like to test the content of this field to:
1* Load the correct rows in the target database
2* Reject the bad rows in an output file or Replace the bad data by a default one (NULL or 01/01/1900 for example)
Should I use tFilterRow ?
What is the method to valid the string pattern ?
How should I declare the data type for this field in my source input file ?

thx
Phil
Labels (2)
14 Replies
Anonymous
Not applicable
Author

Okay, that makes sense, thanks.
On the "tLogRow" I cannot set the date pattern because it is an "int". I am copying the date to a date column (know how to do that) and to an int column in the fact table. The copying to the int column is where I am having issues. I am unfamiliar with the what the correct expression should be.
I cited the SQL Convert example only to show what I am trying to do.
What I need help with is answering how I would convert a date (from the source) to an (8 digit) int (target) to be used as an FK to the Date dim.
Would this be handled at the expression level? Thanks for your patience.
Anonymous
Not applicable
Author

Hello
On the "tLogRow" I cannot set the date pattern because it is an "int".

You need convert date to int, see my screenshot.
Integer.parseInt(TalendDate.formatDate("yyyyMMdd",row2.date))

Best regards
shong
Anonymous
Not applicable
Author

That did it! Thank you very much.
Where could I have found the "Integer.parseInt()"?
It is not available in my expression builder. Is there a list with descriptions some place in Studio?
Thanks again.
Anonymous
Not applicable
Author

Hello
Where could I have found the "Integer.parseInt()"?

It is Java code, not sql function. 0683p000009MA9p.png As you known, Talend product is developed in Java and you are working a Java project.
Best regards
shong
Anonymous
Not applicable
Author

Right, I suppose I should start brushing up on my Java ASAP.
Thanks again for your help.
-Mircea