Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
vitaliichupryna
Creator III
Creator III

Nprinting HTML - How change background color based on the data from field or expression?

Hello,
I'm working on the embedded HTML report. I built HTML table and add necessary styling, one problem is background color for rows in the report. Customers wants see different background based on data in the table. In Qliksense script I created condition that determine color, but I don't know how apply it correctly.


First I created formula with ColorCode as calculation but it breaks structure of my table if I have more than one row in table, so I can use this way only for header.

Then I added ColorCode field in my table and tried to use it as parameter for styling, but it doesn't work.


Is it possible to make background color dynamic?

Thanks,
Vitali

Labels (1)
1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

have you inspected a result of you html? How is your colour values passed?

did you encode your HTML? in properties of the field you are trying to pass as html colour value (see screenshot)

Capture.PNG

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.

View solution in original post

6 Replies
Ruggero_Piccoli
Support
Support

Hi,

I suppose you cannot add the Qlik Sense table as an image.

Could you add some screenshot of the template and the HTML code you are using? I would to understand better and try to reproduce in my installation. 

What version of Qlik NPrinting are you using?

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
vitaliichupryna
Creator III
Creator III
Author

Hi, 

Thank you for help.

Below you can see example of report and html code in attachment.

I use Nprinting November 2018.

Table styling.png

Thanks,

Vitalii

 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

have you inspected a result of you html? How is your colour values passed?

did you encode your HTML? in properties of the field you are trying to pass as html colour value (see screenshot)

Capture.PNG

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.
vitaliichupryna
Creator III
Creator III
Author

Lech, thank you for solution

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Does it work though?  Did you test it?

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.
vitaliichupryna
Creator III
Creator III
Author

Yes, it works as I need.

Thanks,

Vitalii