Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Nikhil2725
Creator II
Creator II

Prefix text

Hi Team,

I have table below:

Sl numIs_correct_answerQuestion_textAnswer_text
10what is the national sport of IndiaCricket
20what is the national sport of EnglandHockey
31what is the national sport of BrazilFootball
41what is the national sport of South AfricaRugby
51what is the national sport of ChinaTable Tennis

 

If the Is_correct_answer=0 then, I should append Incorrect before displaying the Answer_text

Is_correct_answer=1 then, I should append Correct before displaying the Answer_text

However, I want to display as below:

Sl NumQuestion_textUpdated Answer_text
1what is the national sport of IndiaIncorrect: Cricket
2what is the national sport of EnglandIncorrect: Hockey
3what is the national sport of BrazilCorrect:Football
4what is the national sport of South AfricaCorrect:Rugby
5what is the national sport of ChinaCorrect:Table Tennis

 Kindly help me in displaying as above.

11 Replies
miskinmaz
Creator III
Creator III

if(Is_correct_answer=0,'Incorrect :'&only(field_name),
'Correct :'&only(field_name))
Nikhil2725
Creator II
Creator II
Author

Hi Miskinmaz,
Thanks for the reply, However Im geting correct: for each and every answer even though it is Incorrect.
sunny_talwar

Are you looking to do this in the script or front end chart? Also, Is_correct_answer a field or a calculation?

Nikhil2725
Creator II
Creator II
Author

Hi Sunny,
I am looking to do in Front end and is_correct_answer is a field...
sunny_talwar

Would you be able to provide a screenshot where you have Sl num and is_correct_answer as dimension and the expression proposed by @miskinmaz as your expression?

Nikhil2725
Creator II
Creator II
Author

Hi Sunny,
I have used the below the code in the Front end.
if(is_correct_answer=0,'Incorrect:'&Answer_text,'Correct:'&Answer_text)
Can u check whether it is right or not?
sunny_talwar

The code itself looks right... but you are saying it doesn't work?

Nikhil2725
Creator II
Creator II
Author

Hi Sunny,
Any other way to do this?
sunny_talwar

I don't think I understand. Can you answer the below three questions:

1) Is this method working or not working?

2) If it is working, why are you looking for another method?

3) If it isn't working, can you share a sample where we can see it no working