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: 
Not applicable

Error unique fields, combine/merge two fields into one

Can enyone help me?

When I load a specific table I get an error that says I have to use unique fields. I looked at my load statement and indeed found two fields with the samen name. The fields I load holds ID-numbers of suppliers and customers. I want them loaded in the same column called  custSupID.

Example of the script I use now:

customerSupplier:

LOAD

[<bseg>-kunnr] as depSupID,

[<bseg>-lifnr] as credSupID,

[lwa_kna1-name1] as debCompanyName,

[lwa_lfa1-name1] as credCompanyName

What I want is:

[<bseg>-kunnr] as custSupID,

[<bseg>-lifnr] as custSupID (this will give an error because the field is not unique

[lwa_kna1-name1] as companyName,

[lwa_lfa1-name1] as companyName (the same here)



Can I just use sumething like this:

[<bseg>-kunnr] + [<bseg>-lifnr] as custSupID



Will this create a column that holds both ID-numbers?

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

If you want to have the ID's in one column, so each value in a different row, you can do two seperate loads. If you keep the fields the same they will automatically concatenate into one table.

Load

[<bseg>-kunnr] as custSupID,

[lwa_kna1-name1] as companyName,

From......

Load

[<bseg>-lifnr] as custSupID

[lwa_lfa1-name1] as companyName

from.....

View solution in original post

6 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Yes to all your questions,

[<bseg>-kunnr] + [<bseg>-lifnr] as custSupID


is correct, just use & instead +


Let me know

Not applicable
Author

And this will place each unique value in a unique field (underneath each other)? Not that it will combine them one behind the other.....

alexandros17
Partner - Champion III
Partner - Champion III

for each row the contents of the 2 fields will be concatenated in a new field (this happens in each row) ... nothing more

Not applicable
Author

I described the question wrong, I'm sorry. What I want to do is merge/combine two columns into one column. So the new column holds the ID's of the one and the other, but not combined in one field but each ID in a unique field.

stigchel
Partner - Master
Partner - Master

If you want to have the ID's in one column, so each value in a different row, you can do two seperate loads. If you keep the fields the same they will automatically concatenate into one table.

Load

[<bseg>-kunnr] as custSupID,

[lwa_kna1-name1] as companyName,

From......

Load

[<bseg>-lifnr] as custSupID

[lwa_lfa1-name1] as companyName

from.....

Not applicable
Author

Thanks, that's it!