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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Join on tmap and default value

Hi,
I've made a join into a tmap.
- table #1: pid, data1
- table #2: pid, cid
I'm doing database INSERT : pid( found into #1) + cid (found into #2).
But data are incomplete. If i don't have a cid, i've to use a default value as cid.
How can i do ?
Thanks for help.
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

If your tMap does a Left Join, then the field cid will be null if there is no match. You can convert that null into some other value by using this expression in the output field:
row1.cid == null ? "no cid" : row1.cid
(Instead of row1, use the actual name of the input connection.)
Hope this helps.

View solution in original post

6 Replies
Anonymous
Not applicable
Author

If your tMap does a Left Join, then the field cid will be null if there is no match. You can convert that null into some other value by using this expression in the output field:
row1.cid == null ? "no cid" : row1.cid
(Instead of row1, use the actual name of the input connection.)
Hope this helps.
Anonymous
Not applicable
Author

Hi aspiegel,
I have the same question but a slight change. How to use database default values instead of specifying our own default values?

Thanks.
Anonymous
Not applicable
Author

Hi
Don't add this column on schema when inserting records into table, the default value will be inserted into the column.
Best regards
Shong
Anonymous
Not applicable
Author

Thanks alot shong. It works.
Anonymous
Not applicable
Author

Hi,
I have a different situation now for the same question above. I have to compare input values for null and if it is null then I have to load the default value (specified while creating tables) in that column, otherwise source data. So, the question is - if I don't add the column in the output schema then how can I load the data coming from the source.

Thanks.
alevy
Specialist
Specialist

Use a tMap to send the incoming data to two different outputs (one with the column and one without) based on whether the incoming value is null or not.