IF - THEN - ELSE in RTF Template in MSWord

I have an adjustment column that I am trying to calculate.
<?xdofx:if AC_EARNINGS[REPORTING_NAME='Regular'and RATE_MUL is NULL] then CURRENT_AMOUNT else 0 end if?>
When I use this I do not get any errors but do get zeros where I would expect a value.
I have had suggestions for using XSL-FO but this seems to be for more formatting than what I am needing.
Any suggestions.
Thanks

Looks like I spoke too soon. When we were looking at the data I discovered that I did not take it far enough. I missed some date qualifications
Any suggestions on how to embed something like this into BIP. I understand that I may not be able to but really want to try somehting that I know works and gives is the correct number.
How discouraging. :-(
function CF_adjustmentFormula return Number is
l_pay_value number := 0;
l_retro_pay_value number := 0;
l_manual_pay_value number := 0;
begin
IF (:c_hours is not null) THEN
IF ( :cf_retro_hours_salary_flag = 'N' ) THEN
     l_retro_pay_value := 0;
ELSIF ( :cf_retro_hours_salary_flag = 'RH' ) THEN
     IF :earn_reporting_name = 'Regular' THEN
BEGIN -- Retro pay value for Regular OTM
     select sum(to_number(prrv.result_value))
     into l_retro_pay_value
from pay_run_results prr
, pay_element_entries_f peef
, pay_run_result_values prrv
, pay_input_values_f pivf
where 1 =1
and pivf.element_type_id = :earn_element_type_id
and prrv.result_value is not null
and pivf.input_value_id = prrv.input_value_id
and pivf.name = 'Pay Value'
and peef.effective_start_date between pivf.effective_start_date and pivf.effective_end_Date
and prr.run_result_id = prrv.run_result_id
and prr.source_type = 'E'
and prr.status = 'P'
and prr.entry_type='E'
and prr.source_id = peef.element_entry_id
and prr.assignment_action_id = :assignment_action_id
and peef.creator_type = 'RR'
and not exists ( select 1
from pay_element_entries_f pee
, pay_element_types_f pet
where 1 = 1
and pee.effective_start_date = peef.effective_start_date
and pee.assignment_id = :assignment_id
and pee.element_type_id = pet.element_type_id
and pee.effective_start_date between pet.effective_start_date and pet.effective_end_date
and pet.element_name in ('Field Training Officer', 'Motorcycle Time')
and pee.creator_id = peef.creator_id
EXCEPTION
     WHEN OTHERS THEN
     l_retro_pay_value := 0;
END; -- End of Retro Pay value
ELSE     
BEGIN -- Retro pay value
     select sum(to_number(prrv.result_value))
     into l_retro_pay_value
from pay_run_results prr
, pay_element_entries_f peef
, pay_run_result_values prrv
, pay_input_values_f pivf
where 1 =1
and pivf.element_type_id = :earn_element_type_id
and prrv.result_value is not null
and pivf.input_value_id = prrv.input_value_id
and pivf.name = 'Pay Value'
and peef.effective_start_date between pivf.effective_start_date and pivf.effective_end_Date
and prr.run_result_id = prrv.run_result_id
and prr.source_type = 'E'
and prr.status = 'P'
and prr.entry_type='E'
and prr.source_id = peef.element_entry_id
and prr.assignment_action_id = :assignment_action_id
and peef.creator_type = 'RR';
EXCEPTION
     WHEN OTHERS THEN
     l_retro_pay_value := 0;
END; -- End of Retro Pay value
END IF;
ELSE     
BEGIN -- Retro pay value
     select sum(to_number(prrv.result_value))
     into l_retro_pay_value
from pay_run_results prr
, pay_element_entries_f peef
, pay_run_result_values prrv
, pay_input_values_f pivf
where 1 =1
and pivf.element_type_id = :earn_element_type_id
and prrv.result_value is not null
and pivf.input_value_id = prrv.input_value_id
and pivf.name = 'Pay Value'
and peef.effective_start_date between pivf.effective_start_date and pivf.effective_end_Date
and prr.run_result_id = prrv.run_result_id
and prr.source_type = 'E'
and prr.status = 'P'
and prr.entry_type='E'
and prr.source_id = peef.element_entry_id
and prr.assignment_action_id = :assignment_action_id
and peef.creator_type in ('RR', 'EE');
/* and not exists (select 1 from pay_element_entries_f
where effective_start_date = peef.effective_start_date
and assignment_id = peef.assignment_id
and creator_type = 'EE'); */
EXCEPTION
     WHEN OTHERS THEN
     l_retro_pay_value := 0;
END; -- End of Retro Pay value
END IF;
BEGIN -- Manual Adjusment Pay value
               select sum(to_number(nvl(peevf.screen_entry_value, '0')))
                    into l_manual_pay_value
                    from pay_run_results prr
                         , pay_element_entries_f peef
, pay_element_entry_values_f peevf
                         , pay_input_values_f pivf
               where prr.assignment_action_id = :assignment_action_id
and prr.source_type = 'E'
and status = 'P'                          -- Processed
                    and prr.entry_type = 'E'                          -- Entry
               and prr.source_id = peef.element_entry_id
                    and peef.creator_type = 'F' -- Manual Adjustment
                    and peef.date_earned is not null -- Non-Recurring Element
                    and peevf.screen_entry_value is not null -- Pay value exists
                    and peef.element_entry_id = peevf.element_entry_id
                    and peef.effective_start_Date = peevf.effective_start_Date
                    and pivf.name = 'Pay Value'
                    and peevf.input_value_id = pivf.input_value_id
                    and peef.effective_start_Date between pivf.effective_start_Date and pivf.effective_end_Date
                    and pivf.element_type_id = :earn_element_type_id
and not exists (select 1
from pay_element_entry_values_f pev
, pay_input_values_f piv
where pev.element_entry_id = peef.element_entry_id
and pev.effective_start_Date = peef.effective_start_Date
and peef.effective_start_Date between piv.effective_start_Date and piv.effective_end_Date
and pev.input_value_id = piv.input_value_id
and piv.name = 'Hours'
and pev.screen_entry_value is not null);
EXCEPTION
     WHEN OTHERS THEN
     l_manual_pay_value := 0;
     END; -- End of Manual Adjusment Pay value
          -- Total Adjustment Amount
          l_pay_value := nvl(l_retro_pay_value, 0) + nvl(l_manual_pay_value, 0);
          return (l_pay_value);
     else
          return (null);
     end if;
end;

Similar Messages

  • Problem with IF THEN ELSE in RTF template

    HI ALL,
    I have two layouts in the RTF template. Based on the parameter value it has to show the value.
    For example if P_State='United States' then first layout should come. else second one should come.
    I tried to use the IF Then else logic through the form field but i am getting error.
    Please help on this to get it.
    Regards
    Boopathi

    You can do that.
    i guess, the syntax you are using is wrong.
    please refer documentation or this forum for choose:
    Use choose statement. it s better.
    Or send me the template to my id in my profile. or upload it here http://apps2fusion.com/forums/viewforum.php?f=60

  • IF THEN ELSE in DATA TEMPLATE NOT IN RTF

    Hi,
    Can any one tell me How to Implement IF THEN ELSE or DECODE or CASE Logic in a DATA TEMPLATE not in RTF
    as I saw loads of Post about implementing them in RTF not in the Template itself.
    I have a requirement please click this below for the Detailed Version of this Post, Else Please Just give me a Snippet from which i can Implement the IF THEN ELSE Logic in a DATA TEMPLATE( the .xml file) bu please not via a RTF not using PL/SQL Package
    Logic to select Report name based on User's input.
    Thanks
    vasanthanand

    Hello
    I am looking to do the same type of thing did you ever get an answer without having to use a RTF format perhaps in another forum or through investigation?

  • How to use if-then-else-end if in template building?

    hi,
    I am not able to use the "if-then-else-end if" in my template. I want to display a data based on a condition. My requirement is as follows:
    if bal_for_vd < 0 then
    bal_for_vd * no_of_days
    else 0
    end if
    I tried using
    1.<?if: BAL_FOR_VD < 0 then BAL_FOR_VD*NO_OF_DAYS else 0 end if?>
    2.<?xdofx:if BAL_FOR_VD < 0 then BAL_FOR_VD * NO_OF_DAYS end if?>
    3.<?choose:?>
    <?when:BAL_FOR_VD < 0?> <?BAL_FOR_VD * NO_OF_DAYS ?>
    <?end when?>
    <?otherwise?>0
    <?end otherwise?>
    <?end choose?>
    4.<?if:BAL_FOR_VD < 0?><?BAL_FOR_VD*NO_OF_DAYS?><end if?>
    but ended up getting errors or nothing is getting displayed.
    When i used <?BAL_FOR_VD * NO_OF_DAYS ?> alone its working fine and correct getting result. But on giving condition its erring out.
    I will be glad if i get some solution for this.
    Regards,
    Vishnu T Ramakrishnan

    Hi..
    Below syntax should work..I tried with a sample xml..
    <?xdofx:if BAL_FOR_VD < 0 then BAL_FOR_VD * NO_OF_DAYS
      else
    0
    end if?>HTH..

  • Sum function within if/then/else (xdofx:if)

    I'm attempting to display a total at a particular group within my report. This total is conditional and should choose to display a placeholder value or the sum of another placeholder value (in a child group).
    I have been able to vary my output based on the value I want to check: FIXED_QUOTE_FLAG - I have the if/then/else working in a simplified fashion
    I can display literals and some placeholders correctlly eg. print a literal value of 00110011 or the value of placeholder QUOTED_PRICE
    I can also display a calculated placeholder, using sum within the group I am concerned with: sum (current-group()/ACTIVITY_CHRG)
    But when I try to get everythign working together ...
    I cannot get the sum to work inside the if/then/else condition. The result is NULL (blank in HTML output).
    The following is the snippet which is not working correctly:
    <?xdofx:if FIXED_QUOTE_FLAG = 'Y' then QUOTED_PRICE else sum (current-group()/ACTIVITY_CHRG) end if?>
    Message was edited by:
    gareth_adamson

    To answer you first question, perhaps sum is not a supported function in the xdofx namespace. It's annoying when this problem comes up because xdofx namespace seems to be the only way to do if then else clauses. I'm not entirely certain on the above, but you could resort to using BI Publisher's built-in if statement.
    For your problem, something like this:
    <?if: FIXED_QUOTE_FLAG='Y'?>
    QUOTED_PRICE
    <?end if?>
    <?if: FIXED_QUOTE_FLAG!='Y'?>
    <?sum(current-group()/ACTIVITY_CHRG)?>
    <?end if?>
    EDIT:
    There is a way to do if else without xdofx namespace. It is done with <?choose:?> <?when:?> and <?otherwise:?> tags. Here is example syntax copied from Tim Dexter's blog:
    <?choose:?>
    <?when:count(TRX_NUMBER) > 0?>
    Invoice Table
    <?end when?>
    <?otherwise:?>
    No Data Found
    <?end otherwise?>
    <?end choose?>
    To answer the second question about a running total, you will need to use the <?xdoxslt:set_variable($_XDOCTX,'var_name',var_value)?> and the <?xdoxslt:get_variable($_XDOCTX,'var_name')?>. This method of working with variables is the only method that allows you to update a variable. This makes it good for running totals. Consult the official user guide under "Creating an RTF Template" the section about using variables and calculating running totals.
    So, in your problem, once you get the first part working, you will have to add that value to your running total. It will look something like this:
    <?xdoxslt:set_variable($_XDOCTX,'running_total',xdoxslt:get_variable($_XDOCTX,'running_total') + conditional_value)?>
    Remember to initialize the running total to zero! Hope this helps.
    Thanks,
    Matt Soukup
    Message was edited by:
    Matt Soukup

  • Insert Image in RTF Template Conditionally

    Can an image be inserted into an RTF Template using an If-Then statement? Like this:
    <?if:FIELD1='IMAGE1' 'insert IMAGE1' else 'insert IMAGE2'?>
    If this is possible what syntax needs to be where the example says 'insert IMAGE1'? The images are jpg files that exist on a local PC but the template will run on a Unix machine.
    Is there a way to do this? Thank you very much.
    James

    you can try like this
    <?template:image?>
    <?if:FIELD1='IMAGE1'?>
    IMAGE1
    <?end if?>
    <?if:FIELD1!='IMAGE1'?>
    IMAGE2
    <?end if?>
    <?end template?>
    use this tag where u need image <?call:image?>
    for image location or dynamic images check these links
    https://blogs.oracle.com/xmlpublisher/entry/dynamic_images
    https://blogs.oracle.com/xmlpublisher/entry/one_of_our_images_is_missing
    http://learnobi.blogspot.com/2012/08/dynamic-image-in-rtf-of-oracle-bi.html
    Signature image on template

  • Variables in RTF template?

    Variables in RTF template?
    I am battling with variables in RTF template.
    (1) I need to declare and set a variable.
    (2) I like to print it out - check for value
    (3) then I need to make some conditional formatting IF-THEN-ELSE depending on variable value
    THIS DON'T WORK AT ALL (1,2,3):
    (1) declare a variable
    <xsl:variable name="MYCOUNT" select="count(LINE_LOCATIONS/LINE_LOCATIONS_ROW/SHIPMENT_NUM)"/>
    (2) print-out-a-value
    <xsl:value-of select="$MYCOUNT"/>
    (3) IF-THEN-ELSE statement
    <xsl:if test="$MYCOUNT > 1"><xsl:value-of select="concat('mo','re')"/></xsl:if>
    <?if:MYCOUNT="1"?><xsl:value-of select="concat('o','ne')"/><?end if?>
    THIS WORK (1,2) BUT (3) don't work in any way !!!
    (1) declare a variable
    <?xdoxslt:set_variable($_XDOCTX, MYCOUNT, count(LINE_LOCATIONS/LINE_LOCATIONS_ROW/SHIPMENT_NUM))?>
    (2) print-out-a-value
    <?xdoxslt:get_variable($_XDOCTX, MYCOUNT)?>
    (3) IF-THEN-ELSE statement
    <?xdofx:if MYCOUNT=1 then 'one' else 'more' end if?>
    <?xdofx:if $MYCOUNT=1 then 'one' else 'more' end if?>
    <?xdofx:if xdoxslt:get_variable($_XDOCTX, MYCOUNT)=1 then 'one' else 'more' end if?>
    Can someone help me haw to compare a value of variable with constant or another variable or node-value ?
    thx.

    <?xdoxslt:set_variable($_XDOCTX, ‘COUNT’,’YY’)?>
    <?xdoxslt:get_variable($_XDOCTX, ‘COUNT’)?>
    <?if:(xdoxslt:get_variable($_XDOCTX, ’COUNT’)) = ‘YY’?> YEss<?end if?>
    <?if:(xdoxslt:get_variable($_XDOCTX, ‘COUNT’)) = ‘HH’?> Helooo<?end if?>
    <?xdoxslt:set_variable($_XDOCTX, ’YY’, 15)?>
    <?xdoxslt:get_variable($_XDOCTX, ’YY’)?>
    <?if: (xdoxslt:get_variable($_XDOCTX, ’YY’))=15?>Yes Yes<?end if?>
    Variable name is 'COUNT'

  • Instructions "if-then-else" in the texte

    Hello
    I need to create a RTF template with the management of civility :
    I tried this:
    <?xdofx:if MM = 'MRS' then 'Mrs.'
    else
    if MM = 'MR' then 'Mr.'
    else
    'Mrs. and Mr.'
    end if?>
    And it just works.
    But when I add this condition in the texte, it does not work :
    Hello civility, how are you ?
    civility represents the condition+
    How to operate this condition in the texte?

    I tried to include all the text in the text condition, but the number of characters is 384 characters to restrain.
    My my text with the code provided exceeds 384 characters.
    PS : sorry for my bad english, I'm french.

  • If then else

    In one of Tim's blobs (XMLP 5.6.3 for EBS hits the streets) this was mentioned as a new feature:
    "Conditional Formatting Enhancement in RTF Templates
    Now in addition to the xsl:if statement, you can also use the "It...Then...Else" construct in RTF Templates to define conditional formatting."
    Does anybody know the syntax? This one was available before: <?xdofx:if element_condition then result1 else result2 end if?>.
    I was hoping that it would be an improved <?if:condition?> statement, such as <?if:condition?>text1<?else?>text2<?end if?>

    Unfortunately nobody answered until today.
    I assume that the "new feature" isn't implemented in the way dvukajlovic mentioned? For I have use of <?if:condition?>text1<?else?>text2<?end if?> as well...

  • XDOFX if-then-else command testing of space and numeric value

    Hi,
    I have the following xdofx statement in a RTF template to display the value of one variable or another, depending on the value it contains: (the variable can contains both space or null or a numeric value).
    <?xdofx: If Amount_1 = " then 'display amount_2' else If Amount_1 = 0 then 'display amount_2' else 'display Amount_1' end if?>
    Result: When Amount_1 variable contains space or null value, then this If-then-else statement works. But When Amount_1 contains a number such as 0, it gives error "SBL-OMS-00203" (when it's checked against [=" ] in If condition). What's causing this? Is XDOFX being confused to test a variable that supposedly a character string (default by testing against [ =" ]), but find a number in the variable?
    Any work around solution? (So [=" ] and [=0 ] can both be specified against a variable in an if-then-else statement in XDOFX).
    Thanks a lot.
    A.

    try
    <?xdofx:if (Amount_1 =’’) then ‘display amount_2’ else if (Amount_1 =’0’) then ‘display amount_2’ else ‘display Amount_1’ end if?>or
    <?xdofx:if (Amount_1 =’’) then ‘display amount_2’ else if (to_number(Amount_1) =0) then ‘display amount_2’ else ‘display Amount_1’ end if?>

  • How to total 2 colums with an -If then else- statement each

    Hello,
    I have 2 colums A en B who generate data based on an “If then else” statement.
    Colum A
    <?xdofx:if (OMZET_YTD_VJ )!='' then ((OMZET_YTD_VJ) * (BM_YTD - BM_YTD_VJ)) div 100 else 0 end if?>
    Colum B
    <?xdofx:if (BM_YTD)!='' then ((BM_YTD) * (OMZET_YTD - OMZET_YTD_VJ)) div 100 else 0 end if?>
    Colum C needs to be the sum of both. Who can help me?
    Thanks a lot.

    Can you send me the RTF template and xml file to [email protected]? I can take a look and try to help.
    Thanks,
    Bipuser

  • Resetting Header and Footer in RTF templates

    Hi,
    I developed an RTF template (template 1). This template contains start:body and end body for printing the header and footer in all pages. After printing this template then i have to call another template(template 2) from this. I called the template (template 2) using call statement. But the probelm is that the header and footer of template1 is printed in the output of template2 .
    I dont want to print this header and footer for template 2. Can anyone please suggest me in doing this. I placed start:body and end body in the second template with the assumption that 1st template's header and footer will be overwritten. But if i preview then am getting the error
    Font Dir: C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    RTFProcessor setLocale: en-us
    FOProcessor setData: C:\Documents and Settings\kpoda\Desktop\Invoice Printing Efficiencies\Sample XML Data\Sample Output4.xml
    FOProcessor setLocale: en-us
    each
    Please sugget.
    Thanks

    Hi,
    Do you have two templates (template1 & template2) that you want to display in the same document where the pages for template1 has one set of header and footers; and template2 has another set of header and footer?
    If that is the case you can simply create a new section in your rtf template so you have section1 and section2.
    In the body of section1 you call template1 and template2 in the body of section2.
    You can then have different header and footers for the two templates in the same document.
    BR Kenneth

  • How to call a rtf template from another rtf template by passing a value

    Hi Gurus,
    Its about calling a rtf template from another rtf template by passing a value.
    My requirement is like:
    I got a quote report from Siebel, based on the product PartNumber I need to pull product description or literature from another database database.
    My approach is something like; get a partnumber from quote report pass it to another rtf template which uses the partnumber and get the data from table using DataSource. When user pull a quote report from siebel this new rtf template should attach to the quote at the end.
    I've gone through all available blogs about sub-reports and white papers from Oracle they are not much helpful since I need step-by-step.
    http://www.adivaconsulting.com/adiva-blog/item/36-working-with-rtf-sub-templates.html
    bip-subtemplate-1-132933.pdf
    I'm using 10g obiee integrated with Siebel.
    Just started learning BIP.
    Thanks in advance.
    Edited by: 911927 on Apr 2, 2013 8:56 AM
    Edited by: 911927 on Apr 2, 2013 8:57 AM

    How to call a rtf template from another rtf template by passing a value try in main template create hyperlink of url with parameters for another template
    http://bipconsulting.blogspot.ru/2010/02/drill-down-to-detail-or-another-report.html
    When user pull a quote report from siebel this new rtf template should attach to the quote at the end.it'll be only another report
    IMHO you can not attach it to main. it'll be second independent report
    you can try subtemplate but it's not about rtf from rtf by click
    it's about call automatically rtf subtemplate from main rtf based on some conditions
    for example, main template contain some data and if some condition is true then call subtemplate and place it instead of its condition

  • Rtf template not showing as uploaded in concurrent program

    Hello
    I have created xml data definition and uploaded a rtf template. Then linked it to my concurrent program. But when i ran the concurrent program successfully all i get is the xml output. Upon closer inspection it shows that no template is uploaded. Yet in xml publisher it shows as uploaded.
    so my question is: what can prevent a rtf template from attaching to a concurrent program?

    If you and send the template, it would be helpful.
    kindly send it to [email protected]
    Deepa

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates.
    My requirement is :
    create table xxinv_item_pei_taginfo(item_id number,
    Organization_id number,
    item varchar2(4000),
    record_type varchar2(4000),
    record_value CLOB,
    State varchar2(4000));
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'USES','fever','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'HOW TO USE','one tablet daily','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'SIDE EFFECTS','XYZ','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'DRUG INTERACTION','ABC','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'OVERDOSE','Go and see doctor','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'NOTES','Take after meal','TX');
    select * from xxinv_item_pei_taginfo;
    Item id Org Id Item Record_type Record_value State
    493991     224     1265-D30     USES     fever     TX
    493991     224     1265-D30     HOW TO USE     one tablet daily     TX
    493991     224     1265-D30     SIDE EFFECTS     XYZ     TX
    493991     224     1265-D30     DRUG INTERACTION     ABC     TX
    493991     224     1265-D30     OVERDOSE      Go and see doctor     TX
    493991     224     1265-D30     NOTES     Take after meal     TX
    Above is my data
    I have to fetch the record_type from a lookup where I can have any of the record type, sometime USES, HOW TO USE, SIDE EFFECTS and sometimes some other set of record types
    In my report I have to get these record typpes as field name dynamically whichever is available in that lookup and record values against them.
    its a BI Publisher report.
    please suggest

    if you have data in db then you can create xml with needed structure
    and so you can create bip report
    do you have errors or .... ?

Maybe you are looking for