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: 
Loreline
Contributor II
Contributor II

How to show/hide image in PixelPerfect based on value of field selected in QlikSense app?

Hello,

I have created a PixelPerfect report in which I have added 3 images from a local folder. I would like the images to be shown or hidden based on the value of the field LANGUAGE in the QlikSense application.

I have tried the process described by @Daniel_Jenkins in the post "How to define a PixelPerfect DetailReport Visibility via Script (NPrinting)?" without success.

In the QS app I have created the variable vSQSlogo_french =if(LANGUAGE='French', 0, 1). I added it to the NPrinting report's variables objects. I dropped it in the Detail1 section of the report template.

I created a Formatting Rule with the condition "Iif([vSQSlogo_french] = 0, True , False)" and the Visible = True. I set the Data Member as the location level I need in the template.

I added a picture box to the template and selected from a folder the desired image I want to display when the language is French in the QS app.

I applied the rule to the Detail1 and/or to the picture box, with Visible set as No.

No matter what variations I try, they don't work.

Do you have an idea what could go wrong?

Thank you in advance for your help.

 

20 Replies
JonnyPoole
Former Employee
Former Employee

I think I've successfully tested something. 

In this sample I have 2 different detail-reports one for each level placed sequentially after each other. These contain the boolean levels (actually 1 value or null so technically not boolean). I put text tags in seperate 'detail' sections before and after the 2 levels

JonnyPoole_1-1709837178958.png

for both detail-report (level)  sections I had to toggle the highlighted property to 'no'   ("Print when Data Source is Empty") 

JonnyPoole_2-1709837313802.png

Then, when one level resolves to no values and the other resolvers to 1 value. The missing section is collapsed, and the 'detail' sections around the levels collapse to before and after the chart (in your case logo). 

JonnyPoole_3-1709837452509.png

 

 

Loreline
Contributor II
Contributor II
Author

Hello @JonnyPoole, thank you for that it works when I only have the levels per language. But it doesn't work when I add a level based on my location field, which is required. I have reordered the levels in different ways but I never end up with the correct result. 

No matter what I put in the DetailReport band at logo level, it doesn't appear when I generate the report.

Would you have an idea what to do?

Thank you

JonnyPoole
Former Employee
Former Employee

I'm going to take a step back to contrast my sample with your desired output:

In My example:

- The report conditionally shows 1 of 2 objects based on a filter

- Each object (2 in total) requires their own level in the pixel perfect template

- Therefore there will be 2  'DetailReport-level' bands added into the pixel perfect template

- Both 'DetailReport-level' bands need to have the 'print when data source is empty' property set to 'No'.  

In order to adapt this to your use case which has 3 languages and 3 different logos, I anticipate that you require:

- The report conditionally shows 1 of 3 objects based on a filter

- Each object (3 in total) requires their own level in the pixel perfect template

- Therefore there will be 3 'DetailReport-level' bands added into the pixel perfect template

- All 3  'DetailReport-level' bands need to have the 'print when data source is empty' property set to 'No'.  

 

I think you said this is WORKING now for you. Is that correct?  If so, it also sounds like you need to do this again with another field 'location' but you can't get that to work. If that is the case, I would duplicate the report and try to do it JUST with location first to see if the same technique works for location when language is not already in the level show/hide. The answer to that question will allow us to understand if there is an issue with location specifically or if its a broader issue with applying 2 separate sets of levels to the structure of the report.

 

Loreline
Contributor II
Contributor II
Author

Hello @JonnyPoole,

I know I will need 3 levels for the 3 languages but here I am just testing with 2, because if it works with 2 it should be no problem with 3. The 'DetailReport-level' bands for the logos have the 'print when data source is empty' property set to 'No'. The location level is set to 'Yes'. 

The report works properly with only the location level. That's how it was set up in the first place and now I am asked to add the logos.

The problem is that the text and logo I insert in the DetailRerpot for the language level don't show up when I generate the report. Only the part under the dotted line (of the Detail3 in my Screenshot_16 for example) appears.

Also in the PDF the same sheet is duplicated 12 times even if only one product and one location are selected in the QS app. When I do the same selection and run the "old" pixel report without the logo levels the PDF has only one page, which is correct. I thought it may come from the fields to cycle of the report which I didn't touch and are from the "old" version without the logo on field Year_Quarter, Plant and Language. To test I added the field Logo but no change, I tried added the 3 Show_logo_G/F/I fields (Screenshot_13)

 

JonnyPoole
Former Employee
Former Employee

Ok that answers my question ->  It worked with location only and it also worked with language logo only. It fails when doing both together.

I'll see if I can add to the sample provided to have  2 sets of boolean hide/show levels like you need. I'll report back if I find some gotchas. 

JonnyPoole
Former Employee
Former Employee

I added a 2nd set of boolean levels to try emulate what I think you are doing and it works. In my case I have 2 things I want to toggle each with 2 values. So there are 4 possible scenarios:

Show/Show-B

Show/Hide-B

Hide/Show-B

Hide/Hide-B

 

Here are some screenshots.

JonnyPoole_0-1710254973655.png

Here are the formulas that i add just for debug / development purposes.

JonnyPoole_1-1710255140458.png

This is how the selection state looks in the source app:

JonnyPoole_2-1710255194843.png

 

Please also note the 8! data islands to support this. 

JonnyPoole_6-1710255740648.png

 

 

Created a lot of NP filters to test the scenarios. 8 filters in total. a show filter and a hide filter for each of the 4 boolean levels in nprinting

JonnyPoole_3-1710255356960.png

 

The filters are applied on the 'selection' / 'selection2' field for the first set of boolean levels and on 'selectionB' / 'selection2B' on the second set of boolean levels. 

JonnyPoole_4-1710255422584.png

 

I set the 'print when data source is empty' property to none for all 4 levels in the template of course too: 

JonnyPoole_5-1710255638698.png

Here is output for a  show/hide2  and  showB/hide2B scenario

JonnyPoole_7-1710255940141.png

 

Loreline
Contributor II
Contributor II
Author

It looks more complicate than creating 3 pixel perfect report for the 3 languages. The users will only need to choose the report they want in the on-demand button. What do you think?

I thought I would have find another solution than 3 reports but as I didn't get more reply from @David_Friend and @Lech_Miszkiewicz I might go with this option.

 

JonnyPoole
Former Employee
Former Employee

pros and cons for both methods.  It's easier to comprehend the 3  simpler report approach on the NPrinting side  but keep in mind the QS UI is made slightly more complex when you use 3 reports as I would think you need to create 3 on-demand buttons(intead of 1) + a conditional container show/hide to support conditionally showing 1 of the 3 buttons depending on the user's selection state.  

If you need to change the report in the future, it could be nice to just have 1 report to change too. 

There are probably other pros/cons.  Having been through the development of the single report approach I feel comfortable I could script the auto-generation of the data islands quite easily and I would probably hide them using hideprefix. The only pain is the 1 time pixelperfect authoring.  

Since your case is on-demand, you can skip all those 8 NP filters which is a bonus too. 

JonnyPoole
Former Employee
Former Employee

Also... the original reason why I titled that blog post I referenced last week : "The Multi-Report NPrinting template" is that the technique does just that: allow you to design multiple reports in one template. 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

@Loreline - i didnt comment because I had nothing extra to add to this to be honest given that solution is possible and yes it is complicated and @JonnyPoole answered all your questions same way I would.

One thing I dont agree with Jonny is that I would straight away do 3 templates. 

It is much less complex to create 3 OnDemand buttons and handle conditional hide/show of them in container than build 1 report with 3 sections and conditionally manage those sections visibility in Pixel perfect report. People are lot ore familiar with containers than with PixelPerfect reporting.  

Working in 3 individual pixel perfect reports will be much easier for someone new to this template and at the end it is exactly the same amount of work as you still maintaining 3 versions of the report and for each version you maintaining objects. The only thing is that the allignment could be simplified when you have all in one report but that can be managed by pixel perfect approach to sizes of your object.

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.