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: 
Pomna
Creator III
Creator III

Nprinting HTML table if statement

Hello everyone,

I am trying to create a custom message using the if statement on an html table. Below is my code. I need to send a custom message 'no report to show' if the value [Rating]has no value. In other words if the report does not return a value I want it to show the custom message  'no report to show' .

<tr>
<th style="background-color:#58ACFA;width=13%"><P align="left">Issue Number</P></th>
<th style="background-color:#58ACFA;width=14%"><P align="left">Issue Summary</P></th>
<th style="background-color:#58ACFA;width=7%"><P align="center">Rating</P></th>
<th style="background-color:#58ACFA;width=10%"><P align="left">Issue URL</P></th>
<th style="background-color:#58ACFA;width=18%"><P align="left">Assigned Team</P></th>
<th style="background-color:#58ACFA;width=11%"><P align="left">Issue Assignee</P></th>
<th style="background-color:#58ACFA;width=15%"><P align="left">Reporter</P></th>
<th style="background-color:#58ACFA;width=16%"><P align="left">Created Date</P></th>
</tr>
<tr>
<td>%%=[Issue Number]%%</td>
<td>%%=[Issue Summary]%%</td>
<td><P align="center">%%=[CusSat Rating]%%</P></td>
<td><A href="%%Issue URL%%">Link</A></td>
<td>%%=Aggr(if(wildmatch([Assigned Team],'Products*'), [Assigned Team]),[Assigned Team])%%</td>
<td>%%=[Issue Assignee]%%</td>
<td>%%=[CusSat Reporter]%%</td>
<td>%%=[CusSat Created Date]%%</td>

 

Labels (2)
5 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

The way I would handle it would be to have whole thing build into Qlik Sense table like this (simpler though as it will not have any of pivot table complexity): https://nprintingadventures.com/2020/04/24/how-to-build-html-pivot-table-in-nprinting/

Can you share mock up of what the result needs to look like for both scenario? you can just do this in excel for the purpose of presentation...  

Thanks

 

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

I just need a straight table like the one below but I want to include a custom message if there is nothing to report. Like if there is no values to show the report should say 'no report to show'

Pomna_0-1597325978844.png

 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

The thing is if there is no values to show

  • do you still want to see table headers/ table with no records and also show message
  • or
  • do you want to hide table all together and only show the message?

thanks

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

Preferably hide table all together and only show message but  either way is fine.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Option 1:

Create 2 HTML reports

  1. first report with the table when data is present and set condition to send this report when table has values
  2. second report with your custom message condition to run this report when there is no data available.

Option 2:

  1. Use CSS (subject to CSS support in destination client: Web browser, Mail clients etc) and try not to display  an object (see code below). In there I am using display: none style which is created in NPrinting when generating report depending on data availability in the table. Below code is just  example which hides table and shows text "There is no Table to show", but if I would have display: none set in p1 style instead I could show table and hide custom message. Also note that i put style in between body tags as those were used in email embedded reports

 

...<html>      
    
    <body>
    <style>
      table {
           display: none;  
       }
       p1 {
              
       } 
    </style>
    
            <table cellspacing=0 style="border-collapse:collapse;">
            <tr>
            <td>Dim1</td><td>CountExp</td><td>SumExp</td>
            </tr><tr>
            <td>A</td><td>649</td><td>27564</td>
            </tr><tr>
            <td>B</td><td>679</td><td>82187</td>
            </tr><tr>
            <td>147668</td>
            </tr>
            </table>
           <p1>
            There is no Table to show
           </p1>
    </body>
...</html>

 

Option 3:

Create our HTML code in Qlik Table just like in the pivot table example mentioned in my blog post:

https://nprintingadventures.com/2020/04/24/how-to-build-html-pivot-table-in-nprinting/

this is more complicated option but it would be the one I would use preferably.

 

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.