Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

jvk_sharma
Contributor III

How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Hi,

I have a qlikview document with many sheets.So i have created Two buttons like 'back' and 'Clear'.Now I am printing the sheet but the preview button shows Back and clear .How to avoid those coming on to the print.

Any help is highly appreciated.

Regards,

Vamsi.

1 Solution

Accepted Solutions
rahulpawarb
Valued Contributor II

Re: How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Hello Vamsi,

Below is quick solution:

1. Define a variable vIsVisible in Variable Overview dialog (Alt+Ctrl+V) and set default value to 1.

2. Add a new button object and set Text property to Print present under General Tab (i.e. label of button)

3. Next add 3 different actions:

     a. Select Action Tab > Add > Action Type = "External" & Action = "Set Variable" > OK. Set Variable field as vIsVisible and Value as 0.

     b. Select Action Tab > Add > Action Type = "Print" & Action = "Print Sheet" > OK. Set Sheet Id field as SH01 and tick the Show Print Dialog.

     c. Select Action Tab > Add > Action Type = "External" & Action = "Set Variable" > OK. Set Variable field as vIsVisible and Value as 1.

4. Open properties Back button and select Layout tab. Set the Conditional field as $(vIsVisible) <> 0 present under Show.

5. Repeat the step no. 4 for other buttons which you want to hide while printing.

Hope this will help.

Best Regards!

Rahul

7 Replies
rahulpawarb
Valued Contributor II

Re: How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Hello Vamsi,

Below is quick solution:

1. Define a variable vIsVisible in Variable Overview dialog (Alt+Ctrl+V) and set default value to 1.

2. Add a new button object and set Text property to Print present under General Tab (i.e. label of button)

3. Next add 3 different actions:

     a. Select Action Tab > Add > Action Type = "External" & Action = "Set Variable" > OK. Set Variable field as vIsVisible and Value as 0.

     b. Select Action Tab > Add > Action Type = "Print" & Action = "Print Sheet" > OK. Set Sheet Id field as SH01 and tick the Show Print Dialog.

     c. Select Action Tab > Add > Action Type = "External" & Action = "Set Variable" > OK. Set Variable field as vIsVisible and Value as 1.

4. Open properties Back button and select Layout tab. Set the Conditional field as $(vIsVisible) <> 0 present under Show.

5. Repeat the step no. 4 for other buttons which you want to hide while printing.

Hope this will help.

Best Regards!

Rahul

jvk_sharma
Contributor III

Re: How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Hi Rahul,

Thanks for the solution.

It works now exactly how I wanted.

great answer.

cheers.

rahulpawarb
Valued Contributor II

Re: How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Cheers,

Rahul

jvk_sharma
Contributor III

Re: How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Hi Rahul,

Just got some issue.

I have incorporated your logic at my pc (qlikview version 12) it was working fine.

The same code I am trying to do at work (Qlik version 11.2) is not working.

Do you think am i missing anything?

rahulpawarb
Valued Contributor II

Re: How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Hello Vamsi,

To investigate further, could you you please check the order actions assigned to Print Button.

It should be:

1. Set vIsVisible to 0

2. Print Sheet

3. Set vIsVisible to 1

Meanwhile, could you please share the expression defined under Conditional field for all buttons? This will help me to understand the situation.


Thank you!

Rahul

jvk_sharma
Contributor III

Re: How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Hi Rahul,

sorry for the late reply.

Yes the order is right exactly in the print button as mentioned above.

And the expression I have given for the Back button is $(hide) <> 0

No idea , where it is going wrong as it was working fine at my pc.

jvk_sharma
Contributor III

Re: How to print a sheet by hiding the buttons within the sheet(for example Back and clear Buttons)

Hi ,

I worked it out somehow.

I think while defining the variable for print buttons i was using =(variable name) instead of just variable name that worked straight away.

But thanks for your help.

cheers,

vamsi.

Community Browser