Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
davyqliks
Specialist
Specialist

If Match 2 values return Single Value

Hello Experts,

 

I have a situation where i return Correct and Error from a script If statement.

In a table i would like to say if Correct and error return correct else error. 

so i try like this:

If (wildmatch([String Error],'Correct','Error'),'Correct','Error')

 

 

in the below the top roe should be the only error.

Can anyone assist in helping with my measure?

davyqliks_0-1648734137440.png

 

Thank you so much in advance.

 

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

 

Try

=if(count(total <UniquePO> {<[String Error]={'Correct'}>}[String Error])>0,'Correct',if(count([String Error]),'Error'))

OR

= Max( aggr( if(count({<[String Error]={'Correct'}>}[String Error])>0,'Correct','Error'), UniquePO ) )

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

11 Replies
Chanty4u
MVP
MVP

use below in script 

if([String Error]='Correct','Correct',[String Error])   as  StringError 

and use   this field in front end.

davyqliks
Specialist
Specialist
Author

Hi Chanty,

Thanks again for trying to help today:

 

I tried the suggestion and i got the same result with Error and Correct,

We should have in the StringError

Error
Correct
Correct

davyqliks_0-1648737804226.png

Do you have any other suggestion? i tried this in so may ways.

Thanks a lot for your time.

Daniel

vinieme12
Champion III
Champion III

Try below

if( MaxString(TOTAL <UniquePO> [String Error])='Correct','Correct','Error')

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

Try below

if( MaxString(TOTAL <UniquePO> [String Error])='Correct','Correct','Error')

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
davyqliks
Specialist
Specialist
Author

HI,

Thank you very much for your time.

I have tried but sorry to say this returns the below:

davyqliks_0-1648801585953.png

 

davyqliks
Specialist
Specialist
Author

Hi,

May i ask the meaning of this?

<UniquePO>

does this group the result by the dimension?

Thank you

Daniel

vinieme12
Champion III
Champion III

is the field [String Error] a dual value field?

 

You can also try

=if(count({<[String Error]={'Correct'}>}[String Error])>0,'Correct','Error')

 

TOTAL <UniquePO> does this group the result by the dimension? Yes

refer below

https://community.qlik.com/t5/QlikView-App-Dev/Keywords-TOTAL-ALL-DISTINCT/m-p/143516

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
davyqliks
Specialist
Specialist
Author

Hi,

Thanks again for this info and help.

The suggestion gives the correct result for the 'Correct' but omits the Error from the table

With expression added

davyqliks_0-1648805976250.png

and without

davyqliks_1-1648806004109.png

 

Do you have any idea why the measure would not assign the top row as error and just omit from the table?

Thank you


Daniel

vinieme12
Champion III
Champion III

 

Try

=if(count(total <UniquePO> {<[String Error]={'Correct'}>}[String Error])>0,'Correct',if(count([String Error]),'Error'))

OR

= Max( aggr( if(count({<[String Error]={'Correct'}>}[String Error])>0,'Correct','Error'), UniquePO ) )

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.