Skip to main content
Announcements
Qlik Acquires Upsolver to Advance Iceberg Solutions: READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count inside only function

Hi,

Is it possible to incorporate count function inside only function. if not how can i write the below expression.

only({<temp_batch_id={'$(v_module1)'}>}if(count({<result_err_flag={'E'}>}result_err_flag)>0,'E',

if(count({<result_err_flag={'W'}>}result_err_flag)>0,'W',

if(IsNull(result_err_flag),'P'))))

sincerely,

1 Solution

Accepted Solutions
Anil_Babu_Samineni

What is v_modele1 Here, And Try with $ for Selections

if(count({$<result_err_flag={'E'}, temp_batch_id={'$(v_module1)'}>}result_err_flag)>0,'E',

if(count({$<result_err_flag={'W'}, temp_batch_id={'$(v_module1)'}>}result_err_flag)>0,'W',

if(IsNull(result_err_flag),'P','Remaining')))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

10 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

why do you need the only function

maybe something like this

aggr(

f(count({<result_err_flag={'E'}>}result_err_flag)>0,'E',

if(count({<result_err_flag={'W'}>}result_err_flag)>0,'W',

if(IsNull(result_err_flag),'P'))),temp_batch_id)

saimahasan
Partner - Creator III
Partner - Creator III

Try with Aggr() function. May be it helps you.

Anonymous
Not applicable
Author

Actually I have a set of temp_batch_id's. In this expression I have to pass only one temp_batch_id which is stored in the variable v_module1. so for that reason i have used only function.

Anonymous
Not applicable
Author

Actually i don't want this expression to be aggregated against temp_batch_id's. I need to pass few temp_batch_id's only which is stored in some variables like v_module1

Anil_Babu_Samineni

Can you send full expression, I mean Without any variables and i see few flags does this direct field or you created for flag to show 0,1

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

if(count({<result_err_flag={'E'}>}result_err_flag)>0,'E',

if(count({<result_err_flag={'W'}>}result_err_flag)>0,'W',

if(IsNull(result_err_flag),'P'))).   this is my expression and it is working fine. but in this expression i need to pass some temp_batch_id's. for eg: temp_batch_id=v_module1. (all flags are direct fields)

Anil_Babu_Samineni

What was the Variable here?

May be this

if(count({<result_err_flag={'E'}, temp_batch_id={'$(v_module1)'}>}result_err_flag)>0,'E',

if(count({<result_err_flag={'W'}, temp_batch_id={'$(v_module1)'}>}result_err_flag)>0,'W',

if(IsNull(result_err_flag),'P','Remaining')))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

I have tried this. the problem with the this expression is, since the outer condition is an if loop this expression will work only when you select the temp_batch_id as the v_module1. if nothing is selected it wont work.

I want to get the output even though nothing is selected. that's why i tried to use only function

Anil_Babu_Samineni

What is v_modele1 Here, And Try with $ for Selections

if(count({$<result_err_flag={'E'}, temp_batch_id={'$(v_module1)'}>}result_err_flag)>0,'E',

if(count({$<result_err_flag={'W'}, temp_batch_id={'$(v_module1)'}>}result_err_flag)>0,'W',

if(IsNull(result_err_flag),'P','Remaining')))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful