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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Delete white spaces in a tFileInputDelimited

Hi! I have a job with a tFileInputDelimited; some fields of this file have white spaces and when I run the job in Talend 5.4.1 get null values. Fields are BigDecimal type. How can I solve this?
I attach some pictures of file and output of null values. The fields are in yellow.
Thank you.
Regards
0683p000009MED5.jpg 0683p000009MEBt.jpg
Labels (2)
3 Replies
Jj5
Contributor III
Contributor III

Deleting white spaces is easy, you can just do FieldName.replaceAll(" ","") or FieldName.replaceAll("\\s","") if the white space is some character other than a common space. I'm not sure why you're getting the null error though, sorry I couldn't help more.

However since you're performing manipulations on the fields so if you have an empty field you'll get a nullpointerexception error. To fix that you just need to check if the field is empty, like this:
!Relational.ISNULL(FieldName) ? FieldName.replaceAll("\\s","") : null
Basically that checks if the field isn't null. If it isn't, it removes the whitespaces. However if the field is null, then it adds a null value without giving you a nullpointer exception.
Anonymous
Not applicable
Author

I tried this solution but doesn't work; Talend still shows null values on console.
Thank you for your sugestion
Anonymous
Not applicable
Author

Hi,
If the field is big decimal, you can remove the white spaces.
- First need to convert/parse your input fields to string type
- Delete white spaces using java trim/replace
- Convert back to original data type
Your middle column in the screenshot does not look like double, instead has a "-" in the field contents
Have you created metadata for your input file and able to view contents?
Try this.
Vaibhav