Home » Developer & Programmer » Reports & Discoverer » how do I calculate the page number is greated than 1
how do I calculate the page number is greated than 1 [message #417781] Tue, 11 August 2009 09:25 Go to next message
csphard
Messages: 8
Registered: February 2009
Junior Member
I have seen the following code for displaying and not displaying boilerplated items. How do I use it if the page is greater than 1?


I saw this here. displays it on last page

IF srw.get_page_num() = :total_number_of_pages THEN
RETURN FALSE;
ELSE
RETURN TRUE;
END IF;


I saw this on oracle. displays on every other page


function XXX_FormatTrigger return boolean is page_num number;
begin
srw.get_page_num(page_num);
if mod(page_num, 2) = 0 then
return(false);
else
return (true);
end if;
end;

howard
Re: how do I calculate the page number is greater than 1 [message #417795 is a reply to message #417781] Tue, 11 August 2009 09:57 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
By checking the above examples, you would have already understood that "srw.get_page_num()" will return the current page number.
What is stopping you to write the code, which checks the condition for greater than 1?

By
Vamsi
Re: how do I calculate the page number is greater than 1 [message #417804 is a reply to message #417795] Tue, 11 August 2009 10:40 Go to previous messageGo to next message
csphard
Messages: 8
Registered: February 2009
Junior Member
I tried using the following code. However when I get to the next page the text does not display because printing objects on is set to the first page but the boiler plated item still takes up the space. I was trying to use the below code to get rid of it on the second page. Was that not right?

function B_18FormatTrigger return boolean is page_num number;
begin
srw.get_page_num(page_num);
if mod(page_num, 2) > 1 then
return(false);
else
return (true);
end if;
end;

Howard
Re: how do I calculate the page number is greated than 1 [message #417818 is a reply to message #417781] Tue, 11 August 2009 11:13 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why are you using mod?
Re: how do I calculate the page number is greater than 1 [message #417820 is a reply to message #417804] Tue, 11 August 2009 11:23 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Can you write a pl/sql block to check whether x (is a number, which you get as input) is greater than 1 or not and print yes/no accordingly?

Then you can go to reports coding part.

By
Vamsi
Re: how do I calculate the page number is greated than 1 [message #417822 is a reply to message #417818] Tue, 11 August 2009 11:35 Go to previous messageGo to next message
csphard
Messages: 8
Registered: February 2009
Junior Member
I have been searching for examples and found this an example on
oracles site that show the code above for turning on and off
boiler plated items. It was called Creating a boilerplate object for text that displays every other page.

This seem to be away to turn it on and off. So I thought if I configure out if I was on the first page then turn return(false)
and the items would not be completely gone. Where now they are not displayed but they are still there.

Howard
Re: how do I calculate the page number is greated than 1 [message #417824 is a reply to message #417781] Tue, 11 August 2009 11:46 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why do you think they're still there?

And this:
if mod(page_num, 2) > 1 then 

Is never true.
Re: how do I calculate the page number is greated than 1 [message #417831 is a reply to message #417824] Tue, 11 August 2009 12:20 Go to previous messageGo to next message
csphard
Messages: 8
Registered: February 2009
Junior Member
I am sorry. I have been trying to understand this. I still do not. if mod(page_num, 2) > 1 then

I was looking for examples to explain this. I am not sure what ,2 means but I thought this was saying if page_num is greater than 1.

What is this saying.

Howard
Re: how do I calculate the page number is greated than 1 [message #417832 is a reply to message #417831] Tue, 11 August 2009 12:31 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
MOD.
1. Write your own code.
2. Copy paste others' code blindly (without knowing what it is doing) is not recommended/dangerous/senseless.

Have you tried the following?
Quote:
Can you write a pl/sql block to check whether x (is a number, which you get as input) is greater than 1 or not and print yes/no accordingly?

Then you can go to reports coding part.


By
Vamsi

[Updated on: Tue, 11 August 2009 12:33]

Report message to a moderator

Re: how do I calculate the page number is greated than 1 [message #417845 is a reply to message #417832] Tue, 11 August 2009 16:28 Go to previous messageGo to next message
csphard
Messages: 8
Registered: February 2009
Junior Member
I think I now understand the following and that is SRW.GET_PAGE_NUM(page_num) will return the value of the page number in page_num. I am able to use this to display or not to display an item. My problem is that when the item is not displayed I want the items below it to move up and take that space so that I do not have blank white space where the item was.

How do I do that. Is that an anchor. Do I have to anchor it or everything above it to everything below it?


code being used
function F_3FormatTrigger return boolean is page_num number;
begin
srw.get_page_num(page_num);
if page_num > 1 then
return(true);
else
return (false);
end if;
end;
Howard
Re: how do I calculate the page number is greated than 1 [message #417891 is a reply to message #417781] Wed, 12 August 2009 00:50 Go to previous message
shaz
Messages: 182
Registered: June 2009
Senior Member
Create a frame and place the objects in that frame.
when your page no is more then one then automatically the fields will get shifted upwards.
Previous Topic: XML output column
Next Topic: Problem with boilerplated items taking up space on the next page with fields expand vertically
Goto Forum:
  


Current Time: Fri Apr 26 14:43:13 CDT 2024