database - Alter variable format using SQR programming language -
i new peoplesoft , peoplecode/sqr in general , want ask question.
what wish do, try , output large (clob) string variable on pdf file using sqr programming language, on 3 columns on page, can change layout of text in microsoft word going layout -> columns -> 3
what have until this:
begin-select txt.u_po_txt &txt.po_txt ps_u_po_disc_txt txt txt.business_unit = &po.business_unit , txt.po_id = &po.po_id end-select
so,
txt.u_po_txt
is clob stored in database of 10000 characters , want output
&txt.po_txt
on pdf using layout described above.
i have tried using columns , next-column sqr commands no avail. find documentation of sqr on oracle website poorly written.
this example have found, applied case:
columns 10 50 110 move 55 #bottom_line begin-select txt.u_po_txt &txt.po_txt if #current-line >= #bottom_line next-column goto-top=1 at-end=newpage else position (+1,1) !what even, throws me error "unknown command" end-if ps_u_po_disc_txt txt txt.business_unit = &po.business_unit , txt.po_id = &po.po_id end-select
i couldn't find answer anywhere. please me.
i don't think possible using columns
. defining , printing sqr columns determines start printing, text won't automatically wrap once hits end of column. it'll keep printing.
you can, however, use wrap
parameter print
accomplish this. here's example
let $left = 'this left column. left column. left column. left column. left column. left column.' let $middle = 'this middle column. middle column. middle column. middle column. middle column. middle column. middle column. middle column. middle column. middle column. middle column. middle column.' let $right = 'this right column. right column. right column. right column. right column. right column.' ! these variables used track column tallest , ! move current position (#start-line) down largest number of ! lines printed let #line-offset = 0 let #start-line = 1 let #start-line-offset = #current-line - #start-line ! print left column print $left (#start-line, 1) wrap 40 100 if #current-line - #start-line-offset > #line-offset let #line-offset = #current-line - #start-line-offset end-if ! print middle column print $middle (#start-line, 50) wrap 50 100 if #current-line - #start-line-offset > #line-offset let #line-offset = #current-line - #start-line-offset end-if ! print right column print $right (#start-line, 110) wrap 40 100 if #current-line - #start-line-offset > #line-offset let #line-offset = #current-line - #start-line-offset end-if ! update #start-line original line position, plus ! number of lines printed in tallest column let #start-line = #start-line + #line-offset print 'rest of report goes here' (#start-line, 1)
the first number after wrap
character width of column.
the second number after wrap
maximum number of lines printed.
most of complexity in code comes fact you'll have track column printed lines (is largest vertically) , move current cursor position down many lines. difficulty comes fact tallest column may either left or center column, need track column tallest rather moving cursor downward after printing right column. in example, middle column tallest.
the reason i'm using #line-offset
, #start-line-offset
because #current-line
current line position in report including offset header. example, if header 5 lines tall, #current-line
start equal 6 (the first line after header) , doing print 'hello' (#current-line, 1)
print 11th line of report (6 lines down 5 line header). also, assigning value #current-line
doesn't seem work, don't think can manipulate current line position directly.
if, however, don't need print else after 3 columns, can use keep-top
parameter wrap
current line position doesn't change between each print
, don't have of line offset tracking.
in situation, you'll have parse &txt.po_txt
3 separate variables (one each column) based on how text , column position data stored in field.
one thing watch out if have 2 or more spaces in row within data you're printing, sqr may put space first character of line because word breaks seem determined first space, rather sequence of 1 or more spaces.
Comments
Post a Comment