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

How to show the strikethrough in expressions?

For example,

If the result more than 80,than shows 90.

If the result less than 80 , than shows 70.

How to format the expressions?

5 Replies
gmaguina
Partner - Contributor II
Partner - Contributor II

The solution is very tricky. To try to solve your problem, first I tried using the <S> attribute (strikethrough tag in HTML) but is not recognized by QV.
According to manual, the only attribute you can use in Text Format option are:

<B> Bold , <I> Italic , <U> Underline

all those should be single quoted to be recognized for QV.

The tricky solution:

First, build the logic to choose between 90 or 70 depending of condition. Depending of your fields may looks like:

= If ( Sum(Field >= 80), '90' , chr(822) & '7' & chr(822) & '0' & chr(822) )

When the chr(822) is concatenated with a second char this one will appear as strikethrough.
The last chr(822) is just for visual purposes (test without the last one and you will note the difference).

Good luck

Gerardo



Anonymous
Not applicable
Author

I guess it can be set in Text Format,but I don't how to set it.

gmaguina
Partner - Contributor II
Partner - Contributor II

John,

I updated my previous post, now is working with chars. Hope this solve your problem.

Gerardo

Anonymous
Not applicable
Author

Thank you, gmaguina,

The example in my question is only a example. Actually,I want to text format the measure in the table. If the measure more than X , then unstrikethrough. If else,then strikethrough.But I don't the value of the X, maybe X is another field.

gmaguina
Partner - Contributor II
Partner - Contributor II

Ok. You want to strikethrough a Field not the '70' value. In that case there is not easy way to do it. There is not Text Format attribute for that.

A solution for that could be to load 2 fields in script, one with the strikethrough value and another one unstrikethrough, then in the expression choose between show the first or the second one.

To dinamically convert the value to strikethrough in the script, you will need to use Mapping and Replace or a Macro that convert each character to strikethrough version.
If you loading the information from a database you can also use some formulas to build the field as you want to see it.

Well this is just an idea. To be honest, even when this could work, I guess this solution will be complicated to build and use. I agree that would be nice to have more Text Format attributes like <STRIKE> strikethrough <SUB> Subscript <SUP> Superscript

Maybe QT Devs have hidden undocument Text Format to share with us? Big Smile

Gerardo