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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Aditya_Chitale
Specialist
Specialist

Conditional row colouring in HTML Reporting

Hello All,

With the HTML template feature out for SaaS reporting, I was exploring some possibilities which I implemented in my on-premise Nprinting html report. One of which was conditional row colouring in which I created a column in Qlik Sense table that contained color code expressions based on certain criteria.

I then passed this column as an inline style attribute for background color for the column on which I wanted the conditional color to be applied. Here I made sure that 'HTML encode' option is checked for the derived column containing color codes.

I tried to replicated the same scenario in SaaS environment but was unable to do so. Is there any alternate way to achieve this ?

Aditya_Chitale_0-1750846128216.png

In above example the cell colors green, red and blue are passed as hexcode values calculated in a new column in qliksense for inline style bgcolor attribute for the column weekly returns in Nprinting template

@Lech_Miszkiewicz 

 

Regards,

Aditya

Labels (1)
  • Cloud

5 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Aditya_Chitale 

I am seeing this as the biggest missing component and I already voiced to @Andrew_Kruger that this gap needs to be filled. 

As for now-i don know the workaround for this missing feature. 

cheers Lech, 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 to the problem.
Aditya_Chitale
Specialist
Specialist
Author

Hi @Lech_Miszkiewicz ,

Thanks for the reply. I tried to achieve this using automation method. but only got so far with the table creation method. I am still unable to conditional color the row.

In HTML reporting though, if you keep source formatting on for the table, the rows are coloured but any other formatting such as borders, etc get overridden.

Do you by any chance know if this is achievable through automation or not ?

Regards,

Aditya

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Aditya_Chitale 

No i dont - I did spend some time using automations before but I have given up. Frankly I feel bit deflated by this. I am reading through the documentation about the HTML designer in SaaS and I see that there are plenty other restrictions as well which were not there in NPrinting (like those: https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Reporting/html-report-al...) so really at this stage I need to evaluate if any of the reports I have in HTML would be suitable for migration at all given the requirements.

I have opened the Idea you can vote on (and maybe ask others to vote as well) so we can get the "HTML encode" feature back. https://ideation.qlik.com/app/#/case/494814?currentProductId=9da99bc1-0dfb-4471-8e12-d23685578c43&pr...(HTML Encode option available for in app HTML Reporting) although I am afraid that it will be denied as you could sneak in using that methof bit of code which is not allowed and gets removed in designer tool. 

Anyway - lets see how it goes.

 

cheers Lech, 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 to the problem.
Aditya_Chitale
Specialist
Specialist
Author

@Lech_Miszkiewicz 

Again thanks for the input !! I noticed that too. Some part of code gets removed due to Qlik's code sanitation functionality.

Regards,

Aditya

Aditya_Chitale
Specialist
Specialist
Author

Ok So after further digging, I was able to achieve required html report format using automation.

Firstly, drag a "Get straight table data block" in automation and configure it to use required table from qlik saas application

In automation, I used a "variable block" in which I appended color code values to the variable (lets say vColor) using a simple if() statement functionality provided in the "Add Operations" part of the block.

Aditya_Chitale_1-1751196997260.png

The erased part in red from above screenshot is the column which will contain the distinguishing value to color the entire table row. I then passed this value in circled blue part of the condition. If there are multiple values to be checked for highlighting multiple rows, you can append the values in the same variable. Here make sure to choose append rather than using set as this will override previous value of the variable

Aditya_Chitale_2-1751197258628.png

 

Once done with the color variable configuration part, you will need to create an additional variable (lets say vData) which will contain all the columns from "Get straight table data block". Here you can pass the color variable created and configured from previous variable block in the style tag of table html code.

Aditya_Chitale_3-1751197614748.png

Finally in the mail block, add above created variable (vData) to the body of your mail and run the automation.

Aditya_Chitale_4-1751198057734.png

 

Final Output: 

Aditya_Chitale_5-1751198230959.png

My Final Automation structure looks something like this. I have used additiona variable vColorText. But we can ignore that for now.

Aditya_Chitale_6-1751198396065.png

 

 

Regards,

Aditya