Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Relational.ISNULL() fails

Hey,
i want to check the content of Field in a tmap, used as a counter...
If the return of the row is null (=does not exist), i want to set the value 0 for the new row (=INSERT of ROW).
If the the return of the row has a content (>=0), I want to increase the value with 1 (=TIMES of UPDATE)
Field definition: BigDecimal(22,0)
the formula should look like this:
Relational.ISNULL(row6.COUNTING)?0:row6.COUNTING+1
But i get an error in the Test-tool of the Expression Builder, regardless of the used Test-value:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:

The same with a Date:
Like: IF the DATEFIELD IS NULL then gimme sysdate else use DATEFILED
Relational.ISNULL(row6.DATEFIELD)?TalendDate.getCurrentDate():row6.DATEFILED

What is wrong with the two statements? Please help (I am new in Java, only DB-Developer)...
Labels (3)
9 Replies
janhess
Creator II
Creator II

It is probably a problem with the test tool. I've found it happens a lot. Try running the job or click the code tab to see if there are any errors.
Anonymous
Not applicable
Author

Hi,
You can use following expression to increment your count.
row1.COUNTING == null || row1.COUNTING == 0 ? 0 : row1.COUNTING + 1
Please provide us the date format sample, and the information that whether the date is contained in "String" or "Date" Field.
--
Regards,
Vinod
Anonymous
Not applicable
Author

Hi,
Ideally expression row1.DATEFILED == null ? TalendDate.getCurrentDate() : DATEFILED should work, however at my end it is not able to parse any provided date in any format using tFixedFlowInput/tFileInputDelimited component, try same with your job, but if it does not work you can make use of the below mentioned expression
row1.DATEFILEDisEmpty() || row1.DATEFILED.toString() == null ? TalendDate.getCurrentDate().toString() : DATEFILED
Later returned string can be parsed to retrieve Date, using tExtractRegexFields or tConvertType.
--
Regards,
Vinod
Anonymous
Not applicable
Author

Date format expression for string " Fri Aug 31 17:45:53 GMT+05:30 2012"
--------------------------
TalendDate.parseDate("MMM dd yyyy", Var.var1.substring(4,10).concat(Var.var1.substring(29, 34)))

--
Regards,
Vinod
ksrikanthr
Contributor
Contributor

I'm using Talend 5.4.2 and I'm facing the same issue that mpmarky had faced. I understand the alternative way that vinod_talend has provided but I want to know how to use Relational.ISNULL() function for the task that mpmarky tried to do. Is there anyone from the Talend product team that can help us with this ?
Jcs19
Creator II
Creator II

It's : "Relational.ISNULL(row1.myDate)?TalendDate.getCurrentDate():row1.myDate"
(If myDate is NULL then myDate = Today else myDate=myDate )
I just tested it, and it's working.
Anonymous
Not applicable
Author

Hi All,

 

I am also facing same issue. Relational.ISNULL() fails for my job. 

I am using below in tmap for mapping 1 column. Still in output its showing null as result. 

I just need in output, if column value is null then it should be replaced with blank else column result should be printed.

Relational.ISNULL(row8.columnValue) ? "" : (row8.columnValue + ".")

 

Thanks in advance.

Anonymous
Not applicable
Author

@shubhi04 

 

Could you please double check whether the input value is null or empty string in your case? 

 

Relational.ISNULL(row8.columnValue) ? "null value" :row8.columnValue.equals("")? "empty string": row8.columnValue + "."

 

Please try below code to verify your input data and let us know your results.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Anonymous
Not applicable
Author

Hi @Nikhil,

Input values are null in my file. I am initially loading it from csv to staging table and then putting this logic through tmap. So I can see NULL in staging data.

For now, my issue is resolved as I have putted default value as "" . Hence I am able to use your query and its working for me.

Thanks 0683p000009MACn.png