Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
celianou
Contributor II
Contributor II

If value exists in resident table, add a new row

Hi everyone,

I have an SQL query to create table A (table of supplier order points) thanks to several joins.

For the suppliers (who are in the supplier table) who do not have an order point (in table A), I would to create a new row in table A, with default information.

I can't find a way to do this... (I'm new to Qlik)

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

You could try something like this:

Order: load supplier, order, info from Order;
concatenate(Order)
load supplier, 'no order' as order, info from Supplier where not exists(supplier);

whereby you mustn't load Supplier already before because exists() refers to already loaded fieldvalues and therefore the order of load-statements (could) have an impact.

- Marcus 

View solution in original post

4 Replies
sunny_talwar

@celianou Would you be able to share an example with the output you expect to see after running the script?

celianou
Contributor II
Contributor II
Author

I'm creating a fake example for you because I can't communicate my data.

Let's say that in table A :

supplier;OrderPoint;Info_OP_1;Info_OP_2
sup1;2;hello;world
sup2;4;hi;you

And now imagine my supplier table :

supplier;info1;info2
sup1;bla;blabla
sup2;Iam;newbie
sup3;at;Qlik

In this table, sup3 is not in table A.
So I want to add sup3 in table A. It would be :

supplier;OrderPoint;Info_OP_1;Info_OP_2
sup1;2;hello;world
sup2;4;hi;you
sup3;defaultnumber;defaultinfo;defaultinfo

Tell me if it's not clear. It's hard for me to explain.

marcus_sommer

You could try something like this:

Order: load supplier, order, info from Order;
concatenate(Order)
load supplier, 'no order' as order, info from Supplier where not exists(supplier);

whereby you mustn't load Supplier already before because exists() refers to already loaded fieldvalues and therefore the order of load-statements (could) have an impact.

- Marcus 

celianou
Contributor II
Contributor II
Author

Thank you so much Marcus, it works perfectly !