delimited report output using report builder.doc

Upload: pritesh-mogane

Post on 06-Jul-2018

238 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    1/20

    Delimited Report Outputusing Report Builder

    Prepared by:

    Sumana Mukherjee&

    Suvrajyoti Bandyopadhyay

    Page of 20 1

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    2/20

    Contents

    Overview:.........................................................................................................2

    Main Components of a Report Builder:.............................................................3

    Report Customization steps:............................................................................8

    Steps to change the report output to a Pipe delimited output:........................8

    Page of 20 2

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    3/20

    Overview:

    In this tutorial, we will see how to customize the eisting standard Oracle

    report to get a delimited output file instead of the regular la!out" Most

    #usiness users prefer delimited report output as it can easil! #e imported

    into $cel where the! can manipulate and perform calculations on thedata easil!"

    Report Builder is the tool used to develop%customize Oracle reports"

    Before getting into the details, I would li&e to give an overview a#out

    Report Builder"

    Main Components of a Report Builder:

    Below is the snapshot of the O#'ect navigator when !ou open a report in

    Report Builder" Some important components are (ata Model, )a!out

    Model, Parameter form, *riggers" )et+s discuss a#out each one of them in

    detail"

    • (ata Model:

    *he (ata Model is a wor& area in which !ou define what data to

    retrieve when the report is su#mitted" ou create and define -ueries,

    groups, columns, parameters, and lin&s which are called data model

    o#'ects to determine what data needs to #e etracted from the

    data#ase as part of a report"

    Page of 20 3

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    4/20

    *ool Palette in (ata Model view:

    # Object Object Name Description

    1 Select To Select objects for an operation

    2 Magnify To Magnify an area

    3 SQ Q!ery To create a ne" !ery in t$e %ata Mo%el

    &'ef(!rsor

    Q!eryTo (reate a ne" 'ef (!rsor !ery

    Page of 20 &

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    5/20

    )S!mmary(ol!mn

    To create a s!mmary col!mn* + s!mmary col!mn performs a comp!tation li,s!m- a.erage- co!nt- minim!m- ma/im!m- total on anot$er col!mns %ata

    orm!la (ol!mnTo create a orm!la col!mn* + form!la col!mn performs a !ser4%efine%comp!tation on anot$er col!mns %ata

    5 (ross Pro%!ct To create a (ross Pro%!ct gro!p

    6 Data in, To create relations$ip bet"een t"o !eries in t$e %ata mo%el

    7Place$ol%er

    (ol!mn

    To (reate a Place$ol%er col!mn* + place$ol%er is a col!mn for "$ic$ yo! set

    %atatype an% .al!e in P8SQ t$at yo! %efine* 9o! can set t$e .al!e of a place$ol%er col!mn in t$e follo"ing places:

     ;

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    6/20

    )a!out *ool Palette:

    # Object Object Name Description

    1 Select Tool To select one or more objects

    2 rame Select To select frame or repeating frame an% all t$e objects "it$in t$em*

    3 'otate To rotate Objects

    & 'es$ape To c$ange t$e s$ape of t$e objects

    ) Magnify To magnify t$e area

    ine To %ra" a line

    5 'ectangle To %ra" a rectang!lar object

    6'o!n%e%'ectangle

    To %ra" a ro!n%e% rectang!lar object

    7 ?llipse To %ra" a elliptic object

    10 +rc To %ra" arc

    11 Polyline To create a Polyline object

    12 Polygon To %ra" a polygon object

    13 Te/t To create a Te/t object

    1& ree$an% To create a free form ob,@ject

    Page of 20

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    7/20

    1) rameTo create a frame* rames are !se% to s!rro!n% ot$er objects an% protect t$em being o.er"ritten or p!s$e% by ot$er objects

    1'epeating

    rame

    To create a repeating frame* 'epeating frames s!rro!n% all of t$e fiel%s t$at arcreate% for a gro!ps col!mns meaning eac$ repeating frame m!st be associat

    "it$ a gro!p create% in t$e Data mo%el* T$e repeating frame prints =is fire%> ofor eac$ recor% of t$e gro!p*

    15 in, file To create an object t$at is rea% in from file

    16 iel% To create a fiel%

    17 ($art To create a ($art

    20

    21 +nc$or  

    To create an anc$or bet"een t"o objects* Since t$e siAe of some layo!t object

    c$ange "$en t$e report r!ns- yo! nee% anc$ors to %efine "$ere yo! "ant objeappear relati.e to one anot$er*

    22 O?2 To create O?2 object

    • Parameter 2orm:

    Parameter 2orm ena#les !ou to define the parameters for !our report"

    *ool Palette:

    • Report *riggers:

    Report triggers eecute P)%S3) functions at specific times during the

    eecution and formatting of !our report" Report Builder has five glo#al

    report triggers:o 4fter Parameter 2orm trigger:

    *his trigger fires after the Parameter form is displa!ed"o 4fter Report trigger:

    *his trigger fires after the report output is displa!ed" ou can usethis trigger to delete an! temporar! values or ta#les created duringthe process"

    o Before Parameter 2orm trigger:

    *his trigger fires #efore the Parameter form is displa!ed"

    Page of 20 5

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    8/20

    o Before Report trigger:

    *his trigger fires #efore the reports is eecuted #ut after -ueriesare parsed and data is fetched"

    o Between Pages trigger:

    *his fires #efore each page of the report is formatted, ecept the

    ver! first page" *his can #e used to displa! page totals etc"

    Report Customization steps:

    1hen !ou have to customize a standard report, it is alwa!s advisa#le not

    to ma&e changes to the standard report itself, instead rename it to

    another report and ma&e the changes to it"

    Steps:

    • (ownload the original rdf from the file s!stem"

    • Open it in Report #uilder"

    • Save it with a different name that meets the client+s naming

    conventions"

    • Ma&e the necessar! changes to it"

    • Save and compile the report"

    • Move it to the custom top%reports%5S

    • Register it as a concurrent program in Oracle 4pplications under

    custom application"

    Steps to change the report output to a Pipe delimited output:

    *he re-uirement here is to customize the standard 6Receipt 4d'ustment

    report7 to get a delimited output file instead of the regular la!out" *he

    output file should have header information li&e shown #elow on the top of 

    the output page followed #! the receipt ad'ustment data whose fields are

    separated #! 89+"

    Vendor Name~PO Number~PO Line~Po Line Description~Item

    Number~Category~Organization~Ship To Location~Qty Ordered~Net Qty

    ecei!ed~Qty "i##ed~Qty $ccepted~Qty e%ected~Qty Cance##ed~ecei!ed Qty

    Corrected~Net Qty TV~Qty TV Corrected~eceipt Num~Transaction

    Date~Transaction Type~Parent Transaction~Transaction amount~&nit

    Regular )a!out generated #! the standard report:

    Page of 20 6

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    9/20

    1e need Pipe delimited Output file li&e the #elow:

    *o achieve this:

    • 1e have to get rid of the current la!out and create a new la!out

    with o#'ects:

    2rame to print the header information"

    Repeating 2rame to print the data"

    • 1e need to create a 2ormula column in the (ata model that will get

    the concurrent program+s output filename" 1e will use this file to write

    our pipe delimited report output to"

    Steps:

    ;" (ownload the original report PO"rdf 

    Page of 20 7

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    10/20

    " Open the report in the Report Builder" 2ile?Open

    @" Rename it according Custom naming conventions followed #! the

    client" Aere we will rename it to

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    11/20

    ;" *o Create a 2ormula column to derive the output file name:

    • (ou#le clic& on the (ata model in the O#'ect >avigator"

    • Clic& in the tool palette

    • Clic& and drag a rectangle"

    Page of 20 11

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    12/20

    • (ou#leclic& the formula column created in the data model to

    open up its propert! palette where !ou can set its properties"

    >ame: /ive the name as CO5*P5*2I)$

    (ata *!pe: Choose Character

    1idth: @DDP)%S3) 2ormula: Insert the #elow code which gets the

    Concurrent program+s output filename from the data#ase"

    function CO5*P5*2I)$2ormula return Char is

    vfilename fndconcurrentre-uests"outfilenameEt!peF

    #egin

    S$)$C* outfilename

    I>*O vfilename

    2ROM fndconcurrentre-uests

    1A$R$ re-uestid G CO>CR$35$S*I(F

    R$*5R>.vfilename0F

    eception

    when others then

    R$*5R>.null0F

    endF

    Page of 20 12

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    13/20

    ;" (ou#le clic& on the )a!out model in the O#'ect >avigator"

    " Remove all the o#'ects placed in the la!out model ecept 6>o (ata

    2ound7 O#'ect"

    @" Place a 2rame and a repeating frame one #elow the other as shown

    #elow"

    Page of 20 13

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    14/20

    • *o place a frame in the )a!out:

    Clic& in the tool palette"

    Clic& and drag a rectangle"

    (ou#leclic& the frame o#'ect in the la!out to open up its propert!

    palette where !ou can set its properties"

    Page of 20 1&

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    15/20

    Some important properties are discussed here"

    • >ame: Rename it to whatever !ou want"

    • =ertical and Aorizontal $lasticit!: 2or frames and repeating

    frames, elasticit! defines whether the size of the frame or

    repeating frame should var! with the o#'ects inside of it"

    Possi#le =alues that !ou can enter are Contract, $pand, 2ied, and

    =aria#le"

    • Contract means the vertical .for vertical elasticit!0 orhorizontal .for horizontal elasticit!0 size of the o#'ect

    decreases, if the formatted o#'ects or data within it are

    short .for vertical elasticit!0 or less wide .for horizontal

    elasticit!0 enough, #ut it cannot increase to a height

    .for vertical elasticit!0 or width .for horizontal

    elasticit!0 greater than that shown in the Report $ditor"

    Page of 20 1)

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    16/20

    • $pand Means the vertical .for vertical elasticit!0 or

    horizontal .for horizontal elasticit!0 size of the o#'ect

    increases, if the formatted o#'ects or data within it are

    tall or more wide enough, #ut it cannot decrease to a

    height or width less than that shown in the Report$ditor"

    • 2ied Means the height or width of the o#'ect is the

    same on each logical page, regardless of the size of the

    o#'ects or data within it" *runcation of data ma! occur"

    • =aria#le Means the o#'ect ma! epand or contract

    verticall! to accommodate the o#'ects or data within it

    .with no etra space0, which means the height or width

    shown in the Report $ditor has no effect on the o#'ect+s

    height or width at runtime"

    • *o place a repeating frame in the )a!out:

    Clic& in the tool palette"

    Clic& and drag a rectangle"

    (ou#le Clic& on Repeating 2rame to open up the propert! palette and

    rename it" $ver! repeating frame must #e associated with a group

    defined in the (ata model"

    Aere give the Source as 6/shipmentlines7"

    Set the =ertical and horizontal elasticit! to the re-uired"

    Page of 20 1

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    17/20

    ;" *o print a pipe delimited tet in the output file, we will use a format

    trigger on the frame and repeating frame"

    4 format trigger is a P)%S3) function eecuted #efore an o#'ect is

    formatted" *his function must return a Boolean value .*R5$ or 24)S$0"

    (epending on whether the function returns *R5$ or 24)S$, the current

    instance of the o#'ect is included or ecluded from the report output"

    2ormat trigger can #e used to highlight a value, for suppressing values

    and la#els"

    In the propert! palette of the 2rame, under 4dvanced )a!out section:

    Page of 20 15

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    18/20

    (ou#le Clic& on the 2ormat *rigger" *his opens up a S3) $ditor, where !ou

    can place the #elow code to print the header information to the output

    file"

    function MSAIPM$>*)I>$A(R2ormat*rigg return #oolean is

    –Variable declaration

    cmdline =4RCA4R.@DDD0F

    vfilename tetio"filet!peF

    #egin–Setting cmd_line variable to the header info

    cmdline :G 8=endor >ame+HH+9HH+PO >um#er+HH+9HH+PO )ine+HH+9HH+Po

    )ine (escription+HH+9HH+Item

    >um#er+HH+9HH+Categor!+HH+9HH+Organization+HH+9HH+Ship *o

    )ocation+HH+9HH+3t! Ordered+HH+9HH+>et 3t! Received+HH+9HH+3t!

    Billed+HH+9HH+3t! 4ccepted+HH+9HH+3t! Re'ected+HH+9HH+3t!

    Cancelled+HH+9HH+Received 3t! Corrected+HH+9HH+>et 3t! R*=+HH+9HH+3t!

    R*= Corrected+HH+9HH+Receipt >um+HH+9HH+*ransaction

    (ate+HH+9HH+*ransaction *!pe+HH+9HH+Parent *ransaction+HH+9HH+*ransaction

    amount+HH+9HH+5nit+F

    –Opening the concurrent request’s output file to write the data into it 

    –Always prefix !" with the field#when you refer to a field in the data

    model li$e

    :C_OUTPUT_FILE 

    vfilename :G *$.vfilename0 *A$>

    *$

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    19/20

    Similarl! include the #elow code in the format trigger of the repeating

    frame to write the receipt records into the output file"

    function Rshipmentlines2ormat*rigger return #oolean is

    cmdline =4RCA4R.DDD0F

    vfilename tetio"filet!peF#egin

    cmdline :G

    :SourceHH+9HH:(ocument>um#erHH+9HH:)ineHH+9HH:(escriptionHH+9HH:C

    2)$

  • 8/17/2019 Delimited Report Output using Report Builder.doc

    20/20

    ;" >ow move the report to the Custom top%Reports%5S

    " Register it as a concurrent program in Oracle 4pplications and

    assign it to the desired responsi#ilities" Please refer to Concurrent

    Program registration article for registration details"

    P f 20 20