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: 
qlikhalmar
Creator
Creator

Put HTML content as a variable in a NPrinting HTML report

Hi All,

I want to add HTML content into a NPrinting HTML report.

And before NPrinting is generating the HTML, he has to add the value of the variable into the report.

In this case, I want to add a array of data:

['A','AA',100],

['B','BB',250]

If i add it manually it is working fine, but if i add it as a variable (%%vVar%%), it gave me nothing back.

Does anyone of you know how to solve this?

Thanx, Halmar

9 Replies
devarasu07
Master II
Master II

Hi,

is that variable working fine in qlikview side? if so can u r mock. thanks

%%[Variable Name]%%

Tks,deva

qlikhalmar
Creator
Creator
Author

Hi Deva,

The variable works fine in QlikView and I added it in that way  (%%vVar%%).

But it did not work fine. I think it is not working fine inside a HTML part.

Have you tested it?

Halmar

devarasu07
Master II
Master II

Hi,

Yeah. can you share your mock app. so i can check and help you.

Created variable called "vToday" in qlikview and used in Nprinting 16.3 and it's working .

Capture.JPG

qlikhalmar
Creator
Creator
Author

Oke,

My code is:

<html>

  <head>

    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

    <script type="text/javascript">

      google.charts.load('current', {'packages':['table']});

      google.charts.setOnLoadCallback(drawTable);

      function drawTable() {

        var data = new google.visualization.DataTable();

        data.addColumn('string', 'Dim1');

        data.addColumn('string', 'Dim2');

        data.addColumn('number', 'Exp');

        data.addRows([

        %%vVar%%

        ]);

        var table = new google.visualization.Table(document.getElementById('table_div'));

        table.draw(data, {showRowNumber: true, width: '100%', height: '100%'});

      }

    </script>

  </head>

  <body>

    <div id="table_div"></div>

  </body>

</html>

%%vVar%% = 

['A','AA',100],

['B','BB',250]

Ruggero_Piccoli
Support
Support

I would to suggest you tu use native HTML tables that are supported by Qlik NPrinting instead of creating a table by using javascript.

Refer to HTML reports containing tables ‒ Qlik NPrinting.

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 as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.



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.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Did you try to use Formula instead of variable when building NPrinting template? Iremember having similar problem when trying to do dynamic colours in HTML and to get it working i used "FORMULAS"

cheers

Lech

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.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi again,

I actually looked into this bit more and i must say - it is briliant!!!

I have played with Google Charts and NPrinting and must say - this is so cool. Once we have embeded HTML in email body available in NPrinting embeding charts like this may be the way to go. We can do then very slick visualisations/reporting.

BTW - i tested your solution and it worked form me with formula.

regards

Lech

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.
qlikhalmar
Creator
Creator
Author

Hi Lech,

It did not work in my case, but i started another approach.

Just make a start .HTML and a end .html. then generate a CSV, remove the double quotes and concat the three files with a batchfile!

Than you don't need NPrinting.Security can you manage with windows folder security.

Halmar

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi

I took different approach and created concatenated measure witch all characters as a single column (measure), then i used this column to populate values for my Google chart and it worked like a charm.

regards

Lech

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.