Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Karthik_Kommarraju
Contributor
Contributor

Null handling in multiple columns

Hello,

 

My requirement is check null in multiple columns, if null found in any column then mention the reason in error column. Do I need to write java code for that, or I can do it in tmap itself?

 

Kindly suggest.

 

For example 1:

Source:

ID Name   Address   City

 1 Century   abc     

***********************************

Output:

ID Name  Address   City   Error

 1 Century  abc      City is null;

For example 2:

Source:

ID Name   Address   City

 1 Century       

***********************************

Output:

ID Name  Address   City   Error

 1 Century        Address is null; City is null

                  

Labels (5)
1 Solution

Accepted Solutions
prg
Employee
Employee

Hello @Karthik Kommarraju​ ,

 

You can create an expression using a ternary operator according to your requirement;

 

For example;

(row1.city==null && row1.address==null) ? "City and address is null"

: row1.city==null ? "City is null"

: row1.address==null ? "Adddress is null" 

: "No Error" 

 

Please note this is the sample expression. You can build your expression as per your needs.

 

Thanks!!

View solution in original post

6 Replies
billimmer
Creator III
Creator III

you can do this in tmap. For example:

 

row1.City==null ? "City is null" : row1.City

prg
Employee
Employee

Hello @Karthik Kommarraju​,

 

Yes, this can be achieved using tMap.

You can check the source column if it is null and then print using expression builder in tmap.

 

row1.city==null ? "city is null" : row1.city 

 

Please check the screenshots.

 

0693p00000BYCaKAAX.png0693p00000BYCaFAAX.png 

Let us know if it helps and then mark your case as solved (Kudos also accepted).

 

Regards,

Vaishnavi

Karthik_Kommarraju
Contributor
Contributor
Author

But I also want if Address and City is null. then I want to have 'Address is null; City is null' in Error field

Karthik_Kommarraju
Contributor
Contributor
Author

Thanks Vaishnavi. But I also want if Address and City is null. then I want to have 'Address is null; City is null' in Error field. Please check example 2.

prg
Employee
Employee

Hello @Karthik Kommarraju​ ,

 

You can create an expression using a ternary operator according to your requirement;

 

For example;

(row1.city==null && row1.address==null) ? "City and address is null"

: row1.city==null ? "City is null"

: row1.address==null ? "Adddress is null" 

: "No Error" 

 

Please note this is the sample expression. You can build your expression as per your needs.

 

Thanks!!

Karthik_Kommarraju
Contributor
Contributor
Author

This may work. Thanks.