SUM Function in RTF Template

Hi buddies,
can we use functions like SUM,AVG etc. in the RTF Template.
If possible please give adivce for the below scenario
I have one column in the main body table "Extended Amount", I want to sum this field for the another column Total Extended Amount below this Main table.
with regards
Ram

Hi All,
I have a problem in calculating the SUM in RTF template with condition,
Here is the XML
- <LIST_G_LINE_NOTES>
- <G_LINE_NOTES>
<LINE_TRX_ID>1567856</LINE_TRX_ID>
<LINE_ID />
- <LIST_G_TRX_LINE>
- <G_TRX_LINE>
<CF_ITEM_NO>SDCN1144B</CF_ITEM_NO>
</G_TRX_LINE>
</LIST_G_TRX_LINE>
- <LIST_G_LINE_EQUIVALENT_UNIT_PRICE>
- <G_LINE_EQUIVALENT_UNIT_PRICE>
<LINE_EQUIVALENT_UNIT_PRICE>-15.99</LINE_EQUIVALENT_UNIT_PRICE>
<LINE_EXCHANGE_EXTENDED_AMOUNT>-223.86</LINE_EXCHANGE_EXTENDED_AMOUNT>
<CUSTOMER_TRX_LINE_ID>1567856</CUSTOMER_TRX_LINE_ID>
</G_LINE_EQUIVALENT_UNIT_PRICE>
</LIST_G_LINE_EQUIVALENT_UNIT_PRICE>
- <LIST_G_TRX_LINE>
- <G_TRX_LINE>
<CF_ITEM_NO></CF_ITEM_NO>
</G_TRX_LINE>
</LIST_G_TRX_LINE>
I need the summation of field LINE_EXCHANGE_EXTENDED_AMOUNT with the condition CF_ITEM_NO!=''
can anybody help me with the solution.
Thanks in Advance

Similar Messages

  • Issue with ROUND function in RTF template

    Hi All,
    Can anyone please help me in implementing the ROUND function at the RTF template.
    Need to handle rounding of amounts at the RTF template level itself.
    The ROUND function should be implemented to the following tags:
    <?sum(current-group()/TAXABLE_AMOUNT)?> (Record level)
    <?sum(TAXABLE_AMOUNT)?> (Report level total)
    Eg. If the Sum(current-group()/TAXABLE_AMOUNT) for a particular record is 401.65 then it should round of to 402
    we try to do this using following syntax ..
    1) by declaring variable "value"
    <?xdoxslt:set_variable($_XDOCTX, value, sum(current-group()/TAXABLE_AMOUNT))?>
    2) <?xdofx:round(sum(current-group()/TAXABLE_AMOUNT))?>
    3)<?xdofx:round(xdoxslt:sum(current-group()/TAXABLE_AMOUNT))?>
    but we ding get the solution.
    A quick response on this is highly appreciable.
    Thanks,
    Praveen

    Re: Summing derived values within xdofx:
    Re: Rounding not working

  • Problem with extended SQL functions in RTF Template

    Hello,
    I'm new to BI Publisher and I'm trying to create a new rtf template. I've created my layout and added fields without any problems, but I'm having trouble trying to insert calculations such as add,substract,multiply,divide, etc.
    Here is an example of what I'm trying to do:
    <?xdofx:STAFF_ASMT+100?>
    Where STAFF_ASMT is one of my fields. When I add this function all I get is the actual value from that field returned on the first page, and then on other pages I get the value plus an extra zero.
    So with my example data below I get: 6600 on page 1 and 51830 on page 2. Any ideas on what I'm doing wrong or if it is possible to do what I'm doing? Also, is it possible to add/substract/multiple two or more fields together?
    Something like this: <?xdofx:STAFF_ASMT+GROSS_INV?>
    I was going to add all of these functions to my SQL statement, but I have 30 or so calculations I want to perform in the layout and I don't want to have to write that all out in SQL.
    <ROWSET>
    <ROW>
    <STAFF_ASMT>6600</STAFF_ASMT>
    <GROSS_INV>0</GROSS_INV>
    </ROW>
    <ROW>
    <STAFF_ASMT>5183</STAFF_ASMT>
    <GROSS_INV>0</GROSS_INV>
    </ROW>
    </ROWSET>
    Thanks for your help

    When I tried that I get the following error message when I click the Validate Template option:
    [080609_031631893][][ERROR] [Line 162.184] Incorrect XPath: +
    And when I try to generate a PDF preview I get:
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.invokeNewXSLStylesheet(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.transform(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLTWrapper.transform(Unknown Source)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)
         at oracle.apps.xdo.template.FOProcessor.createFO(Unknown Source)
         at oracle.apps.xdo.template.FOProcessor.generate(Unknown Source)
         at RTF2PDF.runRTFto(RTF2PDF.java:629)
         at RTF2PDF.runXDO(RTF2PDF.java:439)
         at RTF2PDF.main(RTF2PDF.java:289)
    Caused by: oracle.xdo.parser.v2.XPathException: Error in expression: './/+'.
         at oracle.xdo.parser.v2.XSLProcessor.reportException(XSLProcessor.java:806)
         at oracle.xdo.parser.v2.XSLProcessor.newXSLStylesheet(XSLProcessor.java:571)

  • Error when using SUM function in Excel template

    I am trying to use the XDO_METADATA to create a sum of a column from my XML data and I am getting the following error in the Template Viewer:
    [111412_104246459][][PROCEDURE] Log Level is changed to PROCEDURE
    [111412_104246553][oracle.xdo.common.xml.XSLTWrapper][ERROR] XSL error:
    Time: 0.125 sec.
    FO Formatting failed.
    <Line 317, Column 116>: XML-23029: (Error) FORG0001: invalid value for cast/constructor
    @Line 317 ==> <Cell Index="2" Style="R7C3" Field="XDO_?SUM_V_CR_MO_IDD1?"><xsl:value-of select="sum(.//G_CR_MST_D/V_CR_MO_IDD)"/>
    when I use:
    XDO_?SUM_V_CR_MO_IDD1?     <?sum(.//G_CR_MST_D/V_CR_MO_IDD)?>
    or
    [111412_104048508][][PROCEDURE] Log Level is changed to PROCEDURE
    [111412_104048554][oracle.xdo.common.xml.XSLTWrapper][ERROR] XSL error:
    Time: 0.078 sec.
    FO Formatting failed.
    <Line 317, Column 105>: XML-23029: (Error) FORG0001: invalid value for cast/constructor
    @Line 317 ==> <Cell Index="2" Style="R7C3" Field="XDO_?SUM_V_CR_MO_IDD1?"><xsl:value-of select="sum(.//V_CR_MO_IDD)"/>
    when I use:
    XDO_?SUM_V_CR_MO_IDD1?     <?sum(.//V_CR_MO_IDD)?>
    I believe the XSL to be correct because when I change it to a count it works and when I go into BI Publisher 11g and create the query in the data model and then create a summary from it, the summary is created.
    Can anyone help?

    I went back to basics and created reports (via EXCEL templates) like I was asking based on good old EMP and DEPT and I found exactly the same problems I was mentioning. I looked at the templates provided but they were not calculating totals, like me they were selecting them and then just displaying them on the page.
    Anyway, I have narrowed it down to the fact that when you do aggregates like sum(.//SAL) this works if you have a salary for every value. I did an outer join with DEPT so I did have empty rows and why I still experienced the problems.
    Basically XSL does not like adding (including using the sum function) values that effectively have nulls in them which is why I get the cast/constructor errors because it is trying to turn a NaN value to a number and does not (or cannot) do it.
    You need to either have a value in every row of your column (maybe possible by selecting nvl in your query) and make sure that you check the "create empty nodes" checkbox in the data model of BI Publisher.,
    the other solution is an xsl solution where you would have to make sure that you only added non null values and for that you would have to investigate xsl blogs.
    It is, by the way, why my count worked because it is just counting that the record exists it does not care what the element content is or isn't.
    Closing thread.

  • XDOXSLT in RTF Templates

    I have a few questions regarding the xdoxslt functions in RTF template making.
    I've been using the Report Designer's Guide here: http://docs.oracle.com/cd/E10415_01/doc/bi.1013/e12187/T421739T481158.htm
    It says <?variable:name?> declares local or global variable? What does this mean? When is it local and when is it global?
    Also I would be interested to know how to concatenate two or more strings with xdoxslt?
    Many thanks

    <?variable:name?>
    Local or global variable declaration i can wrong but
    <?variable:name?> - is global variable
    <?variable@incontext:name?> - is local variable
    as example
    <?variable:NumLine;'Line_Id'?>
    for-each by some element
    using variable NumLine
    end for-eachvariable NumLine is same all time in cycle
    another way
    for-each by some element ( Line_Id is tag )
    <?variable@incontext:NumLine;'Line_Id'?>
    end for-eachevery time the cycle will assigns current Line_Id to variable NumLine - so local in incontext of cycle
    of course it's may exists others cases global or local variables but i gave some point
    Also I would be interested to know how to concatenate two or more strings with xdoxslt?why xdoxslt?
    you can use
    <?concat(‘1’,’%’)?>concat is an XSL expression (http://docs.tpu.ru/docs/oracle/en/fmw/11.1.1.6.0/bi.1111/e22254/extend_func.htm)
    or
    <?value-of:concat(‘2’,’$’)?>or
    <xsl:value-of select="concat('2',' - ', '%')" />or
    <?xdofx:3||2?> http://docs.oracle.com/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm#4535440

  • How to use XDOXSLT in rtf template layout for etext template creation

    <DEFINE CONCATENATION>     BookDetails
    <BASE LEVEL>     Category
    <ELEMENT> Name || '/' || Price     
    <DELIMITER>      '/'
    <END DEFINE CONCATENATION>     BookDetails
    With EFTProcessor the above details are created in xsl file as follows
    <xsl:template name="CONCAT_BookDetails">
    *I need to declare one more variable here
    EG: <xsl:value-of select="xdoxslt:set_variable($mycount, count(.//Category))"/>
    --and use this variable for any dyanamic process inside this template. How to achieve this in rtf template by declaring a xdoxslt function. How to declare this
    syntax in rtf layout so that it creates a varibale in xsl template using the EFTProcessor. Please help me out. The main point here is to include xslt functions in
    rtf template layout for etext template creation.*
    <xsl:for-each select=".//Category">
    <xsl:call-template name="CONCAT_BookDetails_V"/>
    </xsl:for-each>
    </xsl:template>

    in the next time use BI Publisher forum - BI Publisher
    <?format-number(ENTERED_CR,'##,##0.00')?>it's works for me
    output:
    444    ->  444.00
    444.55 ->  444.55

  • SUM function with condition in RTF template

    Hi All,
    I have a problem in calculating the SUM in RTF template with condition,
    Here is the XML
    - <LIST_G_LINE_NOTES>
    - <G_LINE_NOTES>
    <LINE_TRX_ID>1567856</LINE_TRX_ID>
    <LINE_ID />
    - <LIST_G_TRX_LINE>
    - <G_TRX_LINE>
    <CF_ITEM_NO>SDCN1144B</CF_ITEM_NO>
    </G_TRX_LINE>
    </LIST_G_TRX_LINE>
    - <LIST_G_LINE_EQUIVALENT_UNIT_PRICE>
    - <G_LINE_EQUIVALENT_UNIT_PRICE>
    <LINE_EQUIVALENT_UNIT_PRICE>-15.99</LINE_EQUIVALENT_UNIT_PRICE>
    <LINE_EXCHANGE_EXTENDED_AMOUNT>-223.86</LINE_EXCHANGE_EXTENDED_AMOUNT>
    <CUSTOMER_TRX_LINE_ID>1567856</CUSTOMER_TRX_LINE_ID>
    </G_LINE_EQUIVALENT_UNIT_PRICE>
    </LIST_G_LINE_EQUIVALENT_UNIT_PRICE>
    - <LIST_G_TRX_LINE>
    - <G_TRX_LINE>
    <CF_ITEM_NO></CF_ITEM_NO>
    </G_TRX_LINE>
    </LIST_G_TRX_LINE>
    I need the summation of field LINE_EXCHANGE_EXTENDED_AMOUNT with the condition CF_ITEM_NO!=''
    can anybody help me with the solution.
    Thanks in Advance

    Kavipriya,
    Here is the XML
    <LIST_G_LINE_NOTES>
    <G_LINE_NOTES>
    <LINE_TRX_ID>1567856</LINE_TRX_ID>
    <LINE_ID />
    <LIST_G_TRX_LINE>
    <G_TRX_LINE>
    <LINE_DELIVERY_ID />
    <DISCOUNT>0</DISCOUNT>
    <CP_LN_TAX_AMT />
    <CF_ITEM_NO>SDCN1144B</CF_ITEM_NO>
    </G_TRX_LINE>
    </LIST_G_TRX_LINE>
    <LIST_G_LINE_EQUIVALENT_UNIT_PRICE>
    <G_LINE_EQUIVALENT_UNIT_PRICE>
    <LINE_EXCHANGE_EXTENDED_AMOUNT>-223.86</LINE_EXCHANGE_EXTENDED_AMOUNT>
    </G_LINE_EQUIVALENT_UNIT_PRICE>
    </LIST_G_LINE_EQUIVALENT_UNIT_PRICE>
    </G_LINE_NOTES>
    Edited by: user13012317 on Mar 10, 2011 11:00 PM

  • RTF Template: sums with nested groups

    Hi all,
    i've got quite a pickle of a problem it seems ...
    my data structure looks something like this:
    <COMPANY>
    --<STORE>
    ----<DEPARTMENT>
    ------<ITEM></ITEM>
    ----</DEPARTMENT>
    --</STORE>
    </COMPANY>
    multiple companies can have multiple stores, which in turn have multiple departments, which also in turn can have multiple items.
    my select statement looks something like this:
    select company_id,
    store,
    department,
    item,
    sum(qty) as my_sum
    from
    table_1, table_2, table_n
    where ...
    group by ...
    order by company_id;
    my xml data template grouping looks something like this:
    <group name="G_company" ...
    --<element name="E_company" ...
    --<group name="G_store" ...
    ----<element name="E_store" ...
    ----<group name="G_department" ...
    ------<element name="E_department" ...
    ------<group name="G_item" ...
    --------<element name="E_item" ...
    --------<element name="E_item_total" value="my_sum" ...
    ------</group>
    ------<element name="E_department_total" value="G_item.E_item_total" function="SUM()" />
    ----</group>
    ----<element name="E_store_total" value="G_department.E_department_total" function="SUM()" />
    --</group>
    </group>
    my report currently looks something like:
    ------------------<b>Store</b>--------<b>Dept</b>---------<b>Dept</b>---------<b>Item</b>-----------<b>Item</b>---------------<b>Store</b>-----------<b>Dept</b>----------<b>Item</b>-----------<b>Item</b>
    <b>Company</b>---Townsville---TDept_1------TDept_2-----TDItm1----------TDItm2-------------Newcastle------NDept1----------NDItm1--------------NDItm2
    ---CompanyA------2----------------4------------3---------------2---------------1------------------1-------------------3----------------2-------------------4
    ---CompanyB------1----------------2------------4---------------5---------------2------------------1-------------------6----------------3-------------------1
    if i just focus on the Store --> Department --> Item, i achieved this in my RTF template by doing something like the following:
    <table>
    --<tr>
    ----<td><?for-each-group@column:G_store;E_store?>Store</td><td><?for-each-group@column:G_department;E_department?>Department</td><td><?for-each-group@column:G_item;E_item?>Item<?end for-each-group?> <?end for-each-group?> <?end for-each-group?> </td>
    --</tr>
    --<tr>
    ----<td><?for-each-group@column:G_store;E_store?><?E_store_total?></td><td><?for-each-group@column:G_department;E_department?><?E_department_total?></td><td><?for-each-group@column:G_item;E_item?><?E_item_total?><?end for-each-group?> <?end for-each-group?> <?end for-each-group?> </td>
    --</tr>
    </table>
    as you can see, the store --> department --> item go across the report horizontally.
    my problem is i want to have grand totals for each column, like:
    ------------------<b>Store</b>--------<b>Dept</b>---------<b>Dept</b>---------<b>Item</b>-----------<b>Item</b>---------------<b>Store</b>-----------<b>Dept</b>----------<b>Item</b>-----------<b>Item</b>
    <b>Company</b>---Townsville---TDept_1------TDept_2-----TDItm1----------TDItm2-------------Newcastle------NDept1----------NDItm1--------------NDItm2
    ---CompanyA------2----------------4------------3---------------2---------------1------------------1-------------------3----------------2-------------------4
    ---CompanyB------1----------------2------------4---------------5---------------2------------------1-------------------6----------------3-------------------1
    ---<b>Total</b>------------3----------------6------------6---------------7---------------3------------------2-------------------9----------------5-------------------5
    so i did a SUM on each of the E_store/department/item_totals like:
    <?sum(current-group()/E_store_total)?>
    now that works for E_store_total ... but not for E_department_total and E_item_total!
    it seems BI Publisher doesn't like sums used with inner loops.
    because if i extract just the column for E_department, the grand total value at the bottom is correct!
    but once i put back the outer store loop, it breaks.
    what i am currently getting with this is:
    ------------------<b>Store</b>--------<b>Dept</b>---------<b>Dept</b>---------<b>Item</b>-----------<b>Item</b>---------------<b>Store</b>-----------<b>Dept</b>----------<b>Item</b>-----------<b>Item</b>
    <b>Company</b>---Townsville---TDept_1------TDept_2-----TDItm1----------TDItm2-------------Newcastle------NDept1----------NDItm1--------------NDItm2
    ---CompanyA------2----------------4------------3---------------2---------------1------------------1-------------------3----------------2-------------------4
    ---CompanyB------1----------------2------------4---------------5---------------2------------------1-------------------6----------------3-------------------1
    ---<b>Total</b>------------3----------------4------------3---------------2---------------1------------------1-------------------3----------------2-------------------4
    it is doing the grand total for Store correctly, but it just gives me the first row for the other grand totals.
    i have tried:
    1. using the CUBE function in my SQL query, which gives me the results i want with all the totals i want, except i cannot seem to translate it into XML.
    2. trying to use the pivot table option but i can't seem to ever get it to work the way i want.
    3. using a separate sql query to retrieve the grandtotals but that doesn't work either because of the multiple looping required.
    i'm at a complete dead end, any help would be really appreciated!
    ps. i'm a very fresh newbie

    Hi Vetsrini,
    thank you very much!
    when you said to use current-group i was confused because i thought i was using it, but when i opened up the RTF template i realized you meant the actual looping.
    so instead of doing:
    <?for-each-group@column:G_DEPARTMENT;E_DEPARTMENT?>
    <?sum(current-group()/E_STORE_TOTAL)?>
    i should have been doing:
    <?for-each-group@column:current-group()//G_DEPARTMENT;E_DEPARTMENT?>
    <?sum(current-group()/E_ITEM_TOTAL)?>
    thanku!
    S.

  • How to correct XML Output in Cross Tab Template for sum function?

    I have designed a Cross Tab Template to summarize R12 Account Analysis data by Period by Party_name. The template is doing what I want it to do with the exception of amount. I have a function in the sum(accounted_net) field and it will only display 0.00 even though I know there are actual amount. Can someone help in looking at my template to see what I have done wrong?
    Here is the sum funciton.
    <?if:count(current-group()[CCID_SOURCE=$ABC])?><?sum(current-group()[CCID_SOURCE=$ABC]/ACCOUNTED_NET)?> <?end if?>
    CCID_SOURCE is an element I created in XML to concatnate CCID and Party_name for grouping. $ABC is a variable that I defined for "CCID_SOURCE" to check if there is null value for a specific ccid_party. If it's null, it won't do the sum function, otherwise it will sum the accounted_net for the period_name, party_name.
    Thank you for your help.
    Stacey

    Figured this out on our own

  • Use of xdofx:Instr function in a RTF template

    I'm trying to use the xdofx:Instr function within a RTF template but am running into problems because the code produces an error. The following code worked before the data changed:
    <?if:number(DS_SEQ)=1 and( M_TRANTYPE='F')?>
    Now my M_TRANTYPE comes back as 'F,H' so I thought I would use the xdofx:Instr function. I redid the RTF code to read:
    <?if:number(DS_SEQ)=1 and( xdofx:Instr(M_TRANTYPE,'F',1)>0 )?>
    but this fails. I've tried other combinations but they also fail:
    <?if:xdofx:Instr(M_TRANTYPE,'F',1)>0 ?>
    <?if: xdofx:Instr('abc','a',2) >0?>
    Can the xdofx:Instr be used in an "if" construct or am I missing something about its proper use?
    Alex.

    Alex,
    Instr appears to be fine... check the xdofx syntax.
    i.e.
    <?xdofx: if Instr(M_TRANTYPE,'F',1)>0 then DISPLAY_XXX end if?>
    regards,
    Rownald

  • XML Data template. Using the SUM() function

    Hi there,
    I have a data template where I want to create a summary column based on the child group.
    *<group name="G_RO_ESTIMATES" source="Q_RO_ESTIMATES">
    <element name="ESTIMATE_TOTAL" value="G_RO_ESTIMATE_LINES.CHARGE" function="SUM()" />
    <group name="G_RO_ESTIMATE_LINES" source="Q_RO_ESTIMATE_LINES">
    <element name="CHARGE" value="CHARGE" />
    </group>
    </group>*
    ESTIMATE_TOTAL returns 0
    even though the value of the CHARGE column is 760.
    I got the SUM() function to work on another group further down in my data template but for some reason this will not work.
    Does anyone have a clue on what's wrong?
    Thank you in advance.
    BR Kenneth

    give the name of the element diff as CHARGE_TEST
    *<group name="G_RO_ESTIMATES" source="Q_RO_ESTIMATES">
    <element name="ESTIMATE_TOTAL_TEST" value="G_RO_ESTIMATE_LINES_GRP.CHARGE_TEST" function="SUM()" />
    <group name="G_RO_ESTIMATE_LINES_GRP" source="Q_RO_ESTIMATE_LINES">
    <element name="CHARGE_TEST" value="CHARGE" />
    </group>
    </group>*
    sometimes the name get overlapped which results in zero.. keep the names unique
    (i guess , i already logged a bug for this sometime back)

  • Best practice - creating functions in data model vs. rtf template

    Just a general question. Is there a best practice of creating functions in the data model vs. creating the functions in the data template?
    For example, is it more efficient to sum two fields in my SQL query or to create a function in the template that sums the two fields? Just curious if there is any performance benefit of one over the other.
    Thanks!

    anything you push it to DB(SQL), will be the faster than processing outside.

  • How Can I apply a RTF Function on a variable in RTF Template in XML Publisher Report

    Hi Everyone,
    I am developing a RTF Template of XML Publisher Report, I have a variable lv_counter which I can declare using below syntax
    <?xdoxslt: set_variable($_XDOCTX, 'lv_counter',0)?>
    I can access this variable in the template as <?xdoxslt: get_variable($_XDOCTX,'lv_counter')?>
    My need is to print the variable in words in the RTF Template. I am using <?xdofx: to_check_number(xdoxslt: get_variable($_XDOCTX,'lv_counter'))?>
    But this is not working. any help will be appreciated thanks in advance
    The XML Publisher Desktop version which I am using is 10.1.3.3.0
    Please let me know where I can post this question, if this is not the appropriate discussion forum.
    Thanks in Advance.

    Hi,
    Can you elaborate your requirement little bit clear with some example like what is your expected output.
    And you can post you BI related question in the BI publisher forum
    https://forums.oracle.com/community/developer/english/business_intelligence/business_intelligence_foundation/bi_publisher/content?filterID=contentstatus[published]~objecttype~objecttype[thread]
    Regards
    Sri

  • 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

  • Trouble with Group By in RTF Template

    Hello All,
    I'm very new at RTF Template building, and I've spent hours trying to figure this out with no avail. I'm using BIP Desktop add-in for Word to load in my XML data and create some tables and charts. Right now I'm able to create a detail level table on the RTF, but I want to also create a summary level table. The summary table is where I get stuck, as I can't get my group by statements to work. I've tried to insert a table/form and use the table wizard, but neither work.
    My detail level table has customer and shipments (among a few other noncritical fields). I just want a summary table to show customer and total number of shipments (simple count function). Right now, my output looks something like this:
    Customer     Customer
    Brian Jones     Shipment 
         1
         1
         1
         1
         1
         1
         1
         1
         1
    So it groups by the customer fine, but doesn't actually count the shipments. It assigns a 1 for each shipment number, but doesn't actually count the fields to give a Brian - 9.
    Again, I'm very new at this, so this might be very basic. Also, if there are any good resources on RTF template building, I'd love some help on learning to do this stuff better.
    Thanks!
    Alex

    Don't you want to actually find the sum of the shipments to give you a count of shipments for the customer? Have you tried using the sum function for your shipments field?
    You could insert the shipment field, select function sum (from the drop-down menu) and check the 'On grouping' box..
    Send me your template and sample XML to [email protected] if you would like.

Maybe you are looking for