Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
rxp03570
Creator
Creator

Subfield Calculation

Hi,

I do have a requirement where I have to check if any of the subfield data is greater than 0, I have a column(Attribute1) where data is in the format 0/43/61. Here I have to check the if any of the available three values are greater than zero, if yes it is Success or Failed.

Finally I have to do a count of all the success and failures depending on the data. Can someone help me with the logic.

Can we achieve it using Sub field function?

Thanks,

1 Solution

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

use something like below in your script

if(

     (SubField('0/43/61','/',1)+SubField('0/43/61','/',2)+SubField('0/43/61','/',3))>0

     ,1,0) as  SuccessCounter

hope it helps

View solution in original post

3 Replies
dplr-rn
Partner - Master III
Partner - Master III

use something like below in your script

if(

     (SubField('0/43/61','/',1)+SubField('0/43/61','/',2)+SubField('0/43/61','/',3))>0

     ,1,0) as  SuccessCounter

hope it helps

Anonymous
Not applicable

Dilip that will not work unfortunately, because if you add all the values they will be greater than 0 even if one of the fields was 0.

Instead, I would recommend doing the below in the script and just do a sum on the front end to get the count of the number of success or failures.

if(SubField(TextField,'/',1)>0,IF(SubField(TextField,'/',2)>0,IF(SubField(TextField,'/',3)>0,1,0) )) as SuccessFlag

if(SubField(TextField,'/',1)=0,IF(SubField(TextField,'/',2)=0,IF(SubField(TextField,'/',3)=0,1,0) )) as FailureFlag

On the front end you can just sum(Successflag) or Failureflag

dplr-rn
Partner - Master III
Partner - Master III

have to check the if any of the available three values are greater than zero,

Key word is any