LimeReport Forum

General Category | Основное => Discussion | Обсуждение => Topic started by: Kiko on July 14, 2017, 08:31:41 PM

Title: $V{#PAGE_COUNT} on script
Post by: Kiko 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".


Title: Re: $V{#PAGE_COUNT} on script
Post by: Arin Alex 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
Title: Re: $V{#PAGE_COUNT} on script
Post by: Kiko 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.
 
Title: Re: $V{#PAGE_COUNT} on script
Post by: Arin Alex on July 18, 2017, 04:00:39 PM
Yes, I understand your problem and will try to find a solution
Title: Re: $V{#PAGE_COUNT} on script
Post by: Arin Alex 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?
Title: Re: $V{#PAGE_COUNT} on script
Post by: Kiko on July 18, 2017, 07:25:52 PM
The object is a Text Item.
Title: Re: $V{#PAGE_COUNT} on script
Post by: Arin Alex 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
Title: Re: $V{#PAGE_COUNT} on script
Post by: Kiko 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 ?
Title: Re: $V{#PAGE_COUNT} on script
Post by: Arin Alex on July 20, 2017, 08:38:46 PM
Can it be enough to hide pagefooter on last page ?
Title: Re: $V{#PAGE_COUNT} on script
Post by: Kiko on July 21, 2017, 12:25:39 PM
I can't hide the pagefooter because I'm using other items on it.
Title: Re: $V{#PAGE_COUNT} on script
Post by: Arin Alex 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.
Title: Re: $V{#PAGE_COUNT} on script
Post by: Subst on July 22, 2017, 05:22:55 AM
Alex!
more usefull create variables #IS_LAST_PAGEFOOTER AND #IS_FIRST_PAGEHEADER I think :)
Title: Re: $V{#PAGE_COUNT} on script
Post by: Kiko 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"
  }
}
Title: Re: $V{#PAGE_COUNT} on script
Post by: Arin Alex 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 :)
Title: Re: $V{#PAGE_COUNT} on script
Post by: Kiko 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.
Title: Re: $V{#PAGE_COUNT} on script
Post by: Arin Alex on July 26, 2017, 09:01:07 AM
You are welcome :)