Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: $V{#PAGE_COUNT} on script  (Read 7760 times)

Kiko

  • Newbie
  • *
  • Posts: 15
    • View Profile
$V{#PAGE_COUNT} on script
« on: July 14, 2017, 08:31:41 pm »
The variable $V{#PAGE_COUNT} doesn't work on the script block $S{} ?
I used $V{#PAGE} and works fine but the $V{#PAGE_COUNT} gave me the error "SyntaxError: parse error".



Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #1 on: July 14, 2017, 09:06:33 pm »
Unfortunately, you can't use $V{#PAGE_COUNT} in script because it is a second pass variable and is not accessible in time when script is executing

Kiko

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #2 on: July 18, 2017, 01:08:16 pm »
Thank you for the quick answer, but my problem persist.
How to hide or show an item based on the current page ?
E. g If is the last page I have to hide the item, otherwise I have to show it in the other pages of my report.
 

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #3 on: July 18, 2017, 04:00:39 pm »
Yes, I understand your problem and will try to find a solution

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #4 on: July 18, 2017, 04:34:56 pm »
Could you elaborate on what type of objects do you want to hide on the last page?
« Last Edit: July 18, 2017, 04:36:28 pm by Arin Alex »

Kiko

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #5 on: July 18, 2017, 07:25:52 pm »
The object is a Text Item.

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #6 on: July 18, 2017, 07:55:04 pm »
Where are the items located ? May be on the pagefooter or pageheader? The problem is that in the first pass i don't know what page is rendered last or not, until the last page not finished. if i hide items on the second pass the band will not be resized

Kiko

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #7 on: July 19, 2017, 12:44:43 pm »
The item is located on the Page Footer band.
I'm using Qt 5.9.1 and my datasource is provided by data transfer and linking to a report generator by SIGNAL­-SLOT approach.

Is it possible to create a parameter to force a 3rd pass where you could have access to the second pass variables in the script blocks or resize the bands ?

Wouldn't be possible to access the objects of my report before the preview/print ?
« Last Edit: July 19, 2017, 12:56:11 pm by Kiko »

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #8 on: July 20, 2017, 08:38:46 pm »
Can it be enough to hide pagefooter on last page ?

Kiko

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #9 on: July 21, 2017, 12:25:39 pm »
I can't hide the pagefooter because I'm using other items on it.

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #10 on: July 21, 2017, 08:39:37 pm »
I have added new system variables (#IS_LAST_PAGEFOOTER & #IS_FIRST_PAGEFOOTER).
I hope it will usable for you.

Subst

  • Sr. Member
  • ****
  • Posts: 450
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #11 on: July 22, 2017, 05:22:55 am »
Alex!
more usefull create variables #IS_LAST_PAGEFOOTER AND #IS_FIRST_PAGEHEADER I think :)

Kiko

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #12 on: July 24, 2017, 02:15:51 pm »
Hey Alex,
I downloaded the last version from GitHub.
Thank you for your modifications, will be very useful to me.
However the system variable #IS_FIRST_PAGEFOOTER is always returning false.
Can you fix it ?

This is the script that I'm using to test the version:
Code: [Select]
$S{
  if($V{#IS_FIRST_PAGEFOOTER}){
   "a"
  }else{
   "b"
  }
}

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #13 on: July 24, 2017, 10:49:42 pm »
I have fixed #IS_FIRST_PAGEFOOTER :)

Subst if you need #IS_FIRST_PAGEHEADER i can add it :)

Kiko

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: $V{#PAGE_COUNT} on script
« Reply #14 on: July 25, 2017, 07:50:59 pm »
#IS_FIRST_PAGEFOOTER works fine !

Thank you for adding these two variables, it helped me a lot.