Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Peony
Creator III
Creator III

How to count values in variable

Hi all. 
I have a variable like this:
SET v_Identifier = 'audit_id','audit_type','audit_date'; 

Currently there is a 3 itemes. But this amount could be changed. So I need dynamicly count amount of items in this variable.

Could you plese give a hint how to do this?


Labels (3)
1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

Accoding the your needs, different solutions can be applyed, one can be:

SubStringCount(v_Identifier,',')+1

micheledenardi_0-1727260946029.png

 

 

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

3 Replies
micheledenardi
Specialist II
Specialist II

Accoding the your needs, different solutions can be applyed, one can be:

SubStringCount(v_Identifier,',')+1

micheledenardi_0-1727260946029.png

 

 

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
alsadam
Contributor II
Contributor II


@Peonynjmcdirect wrote:

Hi all. 
I have a variable like this:
SET v_Identifier = 'audit_id','audit_type','audit_date'; 

Currently there is a 3 itemes. But this amount could be changed. So I need dynamicly count amount of items in this variable.

Could you plese give a hint how to do this?



To dynamically count the number of items in your variable v_Identifier, you can use a combination of string functions. Since you're using a string that contains items separated by commas, you can split the string and count the resulting parts.

 

Peony
Creator III
Creator III
Author

@micheledenardi thank you! this is what I need.