Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Elarbe
Contributor III
Contributor III

Loading data from a column unless conditions met, otherwise load from a different column

Hello all,

wanted to get some expert opinion on this because I haven't been using Qlik that long.

Basically I'm loading the following data from a QVD and I'm trying to figure out if the changes I want to make should be done in QlikView when creating the QVD or if this logic can be done in Qlik Sense using the current QVD.

The script looks like this:

Concatenate (MaterialNote_tmp) Load

ID_Key,

Country,

Description1 as Usernames,

Description2,

Description3,

Description4,

Description5 

in the column Description1 there are a lot of names, which is what I want, but there are also a lot of entries of the Format "V54644842", so a V followed by 8 numbers. The name associated with this V entry is then in Description2.

I want to load everything from Description1 unless it is one of these V numbers, then Description2 should be loaded into the column instead. I tried in Qlik Sense with the following but i'm not getting the desired outcome:

 if NOT WildMatch(Description1,'^V*') THEN

Concatenate (MaterialNote_tmp) LOAD Description2 as Usernames; ELSE

Concatenate (MaterialNote_tmp) LOAD Description1 as Usernames;

 

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

I'm not sure I understood the requirement, but it sounds like you're not trying to modify the entire load, just the specific Usernames field (which is itself a rename of another field). If that's the case, perhaps:

Concatenate (MaterialNote_tmp) Load

ID_Key,

Country,

If(WildMatch(Description1,'V*'),Description2,Description1) as Usernames,

Description1,

Description2,

Description3,

Description4,

Description5

View solution in original post

3 Replies
Or
MVP
MVP

I'm not sure I understood the requirement, but it sounds like you're not trying to modify the entire load, just the specific Usernames field (which is itself a rename of another field). If that's the case, perhaps:

Concatenate (MaterialNote_tmp) Load

ID_Key,

Country,

If(WildMatch(Description1,'V*'),Description2,Description1) as Usernames,

Description1,

Description2,

Description3,

Description4,

Description5

Elarbe
Contributor III
Contributor III
Author

@Or 

Thank you for taking the time to answer, in the mean time I continued trying and also came up with something similar which has worked.

The only issue is that some names also begin with V and with these parameters of WildMatch, they are also being replaced. How could I edit the expression to only replace codes that start with V and have 8 numbers following, for example?

Or
MVP
MVP

If memory serves WildMatch doesn't have an option for that, but you could check on IsNum(Right(Description1,8))