1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Need Help with before report code

Discussion in 'Oracle Forms and Reports' started by sanjeevsinha0102, Apr 30, 2009.

  1. sanjeevsinha0102

    sanjeevsinha0102 Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    Location:
    banglore
    I have written in before report below code
    Code (Text):

    if :P_SORT = 'Applicant' Then
            :P_SORT_BY :='Applicant';
        elsif :P_SORT = 'Requestor' Then
            :P_SORT_BY :='Requestor';
        elsif :P_SORT = 'CostCenter' Then
            :P_SORT_BY :='CostCenter';
        end if;
     
    when user parameter pass Applicant,requestor and costcenter it come under P_SORT it check in before report after that pass in :p_sort_by what ever pass in p_sort

    I have written in side Sql
    Code (Text):

    , substr(c.DESCRIPTION,instr(c.DESCRIPTION,'[',1)+1,instr(c.DESCRIPTION,']',1,1)-2) Applicant

    , substr(c.DESCRIPTION,instr(c.DESCRIPTION,'-',1)+1,  instr(c.DESCRIPTION,'-',1,2)-instr(c.DESCRIPTION,'-',1,1)-1)  Requestor

    , substr(c.DESCRIPTION,instr(c.DESCRIPTION,'[NOTES:'),240) CostCenter
     
    these all three i have selcted in sql (check in data block Q_lines G_lines)

    end of sql i am using
    Code (Text):

    orderby
    :P_SORT_BY
     
    but what ever i have passing it is short by only what ever i put in TOP data block
    (G_LINE_TOTAL)


    Sanjeev
     
  2. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
    Hi,

    I think you need to use below code.


    if :p_SORT = 'Applicant' Then
    :p_SORT_BY :=:Applicant;
    elsif :p_SORT = 'Requestor' Then
    :p_SORT_BY :=:Requestor;
    elsif :p_SORT = 'CostCenter' Then
    :p_SORT_BY :=:CostCenter;
    end if;


    Here ':' referes column name from data model.

    Hope this will help you......