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: 
RedKetchup69
Contributor
Contributor

Creating a new field with multiple condition values stored in variables

Hi All,

I've been struggling to find answer here that I can apply to my own scenario. I'm very new but I'll do my best to explain clearly:

My table contains bank transactions:

LOAD
"Date",
"Name / Description",
Account,
Counterparty,
Code,
"Debit/credit",
"Amount (EUR)",
"Transaction type",
Notifications

I've been trying to create an additional 'Category' field in which I want to categorize the transactions based on the values "Name / Description" field. For example, if the string from "Name / Description" matches a shop name from the variable vCatGroceries then the value in the newly created 'Type' field value for this record would be 'Groceries', or if it instead matches a string from the variable vIndividuals then it would be classified as  'Transfer' and so on. 

The goal is that I would like to set up a variable for each category where I could add more conditions  later on without having to modify anything else in the script.

SET vCatGrocecies='*shop1*','*shop2*','*shop3*','*shop4*';
SET vCatIndividuals='*person1*','*person2*','*person3*','*person4*';

I tried the below so far, but could only get it to work without using the variables themselves and only with 1 category as I wasn't sure how to make this work with an OR statement for the additional categories.
IF(WILDMATCH([Name / Description],'*shop1*','*shop2*','*shop3*','*shop4*')>0,'Groceries') as Type,

Thanks in advance!

 

Labels (3)
2 Replies
sidhiq91
Specialist II
Specialist II

@RedKetchup69  Could you please provide some sample data for me to work on it? Thanks.

marcus_sommer

I wouldn't try to categorize such data with variable-lists and wildmatch-approaches else loading these data within tables which are then associated to your facts and/or using a Mapping ‒ approach for it.

- Marcus