2016年6月13日 星期一

[Oracle]How to get Physical Page Number in report?[SRW.GET_PAGE_NUM (page_num)]

最近有客戶的報表,想一次列印出三份,右側分別呈現第一欄第二欄第三欄
一時想不到好方法,採用目前MOD(頁數,3)來判斷該呈現第幾欄
餘數1第一欄,餘數2第二欄,餘數0第三欄

在文字的格式Trigger撰寫語法如下

function B_30FormatTrigger return boolean is

  page_num NUMBER;
  slip NUMBER;

begin

  SRW.GET_PAGE_NUM(page_num);
  slip := mod(page_num,3);
 
  if ((slip = '0') or
      (slip = '2'))
  then
    return (FALSE);
  end if;

  return (TRUE);
 
end;



另外提供Physical Page Number如在報表上呈現 Step by Step

1. Create or add a new item in the Layout Report.
2. Select the Property Palette option of that item.
3. Change the following properties:

Source: Page Number
Source Data Type: Number

4. Edit the property 'Format Trigger' with the code:
function F_1FormatTrigger return boolean is
page_num NUMBER;
begin
SRW.GET_PAGE_NUM(page_num);
return (TRUE);
end;

5. To hide the item from the report, change property 'Visible' to NO.



SRW.GET_PAGE_NUM (page_num)說明

Description: This procedure returns the current page number. This is useful when you want to use the page number in the field's Format Trigger property. 
Syntax: 
SRW.GET_PAGE_NUM (page_num); 
Parameters: 
page_num: Is the variable in which you want to place the 
current page number. 
Returns: The current page number

沒有留言:

張貼留言