Logic to print data in required format for XML

Hi,
Please find the xml format:
<ListOf_ssFsInvoice>
<ssFsInvoice>
<ListOf_ssFsInvoiceLineItems>
<ssFsInvoiceLineItems>
<ListOf_ssFsInvoiceLineItemDetails>
<ssFsInvoiceLineItemDetails>
<ssDnrmPartBillingType>Paid</ssDnrmPartBillingType>
<ListOf_ssFsInvoiceLineItemDetailTaxes>
<ssFsInvoiceLineItemDetailTaxes>
<ssTaxName>VAT</ssTaxName>
<ssAmount>1000</ssAmount>
</ssFsInvoiceLineItemDetailTaxes>
<ssFsInvoiceLineItemDetailTaxes>
<ssTaxName>Entry</ssTaxName>
<ssAmount>2000</ssAmount>
</ssFsInvoiceLineItemDetailTaxes>
<ssFsInvoiceLineItemDetailTaxes>
<ssTaxName>XYZ</ssTaxName>
<ssAmount>500</ssAmount>
</ssFsInvoiceLineItemDetailTaxes>
</ListOf_ssFsInvoiceLineItemDetailTaxes>
</ssFsInvoiceLineItemDetails>
</ListOf_ssFsInvoiceLineItemDetails>
</ssFsInvoiceLineItems>
</ListOf_ssFsInvoiceLineItems>
</ssFsInvoice>
</ListOf_ssFsInvoice>
Requirement:
1.For ssDnrmPartBillingType = Paid print total of ssAmount for similar ssTaxName and ssTaxName should appear only once in report for each ssTaxName.
2.e.g.
Line item 1:
Paid VAT 1000
Paid Entry 200
Paid XYZ 100
Line item 2:
Paid VAT 100
Paid Entry 100
Paid XYZ 50
Report Output
VAT 1100
Entry 300
XYZ 150
and so on.
How to use for each loop and sum function so that for all grouped items summation can be printed and repeated item appears only once that too in hierarchical structure as shown above.
Any suggestion?
Thanks in advance.

Try this:
<?for-each-group:ssFsInvoiceLineItemDetailTaxes;./ssTaxName?>
<?ssTaxName?> <?sum(current-group()/ssAmount[../../../ssDnrmPartBillingType='Paid'])?>
<?end for-each-group?>
This should give you the correct amounts.
If this resolves your issue, please assign points and mark the thread as answered.
Thanks,
BIPuser

Similar Messages

  • SSMS 2012:FOR XML PATH Using XPath Node Tests-Columnn name 'test()' contains an invalid XML identifier as required by FOR XML?

    Hi all,
    I am learning XPATH and XQUERY from the Book "Pro T-SQL 2008 Programmer's Guide" written by Michael Coles, (published by apress). I copied the Code Listing 12-8 FOR XML PATH Using XPath Node Tests (listed below) and executed it in my
    SQL Server 2012 Management Studio:
    --Coles12_8.sql // saved in C:/Documemnts/SQL Server Management Studio
    -- Coles Listing 12-8 FOR XML PATH Using XPATH Node Tests
    -- Retrieving Name and E-mail Addresses with FOR XML PATH in AdvantureWorks
    -- 16 March 2015 0935 AM
    USE AdventureWorks;
    GO
    SELECT
    p.NameStyle AS "processing-instruction(nameStyle)",
    p.BusinessEntityID AS "Person/@ID",
    p.ModifiedDate AS "comment()",
    pp.PhoneNumber AS "test()",
    FirstName AS "Person/Name/First",
    MiddleName AS "Person/Name/Middle",
    LastName AS "Person/Name/Last",
    EmailAddress AS "Person/Email"
    FROM Person.Person p
    INNER JOIN Person.EmailAddress e
    ON p.BusinessEntityID = e.BusinessEntityID
    INNER JOIN Person.PersonPhone pp
    ON p.BusinessEntityID = pp.BusinessEntityID
    FOR XML PATH;
    I got the following error message:
    Msg 6850, Level 16, State 1, Line 2
    Column name 'test()' contains an invalid XML identifier as required by FOR XML; '('(0x0028) is the first character at fault.
    I have no ideas why I got this error message.  Please kindly help and advise me how to resolve this error.
    Thanks in advance,  Scott Chang

    Hi Michelle, Thanks for your nice response.
    I corrected the mistake and executed the revised code. It worked nicely.
    I just have one question to ask you about the appearance of the xml output of my Co;les12_8.sql:
    <row>
    <?nameStyle 0?>
    <Person ID="1" />
    <!--2003-02-08T00:00:00-->697-555-0142<Person><Name><First>Ken</First><Middle>J</Middle><Last>Sánchez</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="2" />
    <!--2002-02-24T00:00:00-->819-555-0175<Person><Name><First>Terri</First><Middle>Lee</Middle><Last>Duffy</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="3" />
    <!--2001-12-05T00:00:00-->212-555-0187<Person><Name><First>Roberto</First><Last>Tamburello</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="4" />
    <!--2001-12-29T00:00:00-->612-555-0100<Person><Name><First>Rob</First><Last>Walters</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="5" />
    <!--2002-01-30T00:00:00-->849-555-0139<Person><Name><First>Gail</First><Middle>A</Middle><Last>Erickson</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="6" />
    <!--2002-02-17T00:00:00-->122-555-0189<Person><Name><First>Jossef</First><Middle>H</Middle><Last>Goldberg</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="7" />
    <!--2003-03-05T00:00:00-->181-555-0156<Person><Name><First>Dylan</First><Middle>A</Middle><Last>Miller</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="8" />
    <!--2003-01-23T00:00:00-->815-555-0138<Person><Name><First>Diane</First><Middle>L</Middle><Last>Margheim</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="9" />
    <!--2003-02-10T00:00:00-->185-555-0186<Person><Name><First>Gigi</First><Middle>N</Middle><Last>Matthew</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="10" />
    <!--2003-05-28T00:00:00-->330-555-2568<Person><Name><First>Michael</First><Last>Raheem</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="11" />
    <!--2004-12-29T00:00:00-->719-555-0181<Person><Name><First>Ovidiu</First><Middle>V</Middle><Last>Cracium</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    I feel this xml output is not like the regular xml output.  Do you know why it is diffrent from the regular xml xml output?  Please comment on this matter.
    Thanks,
    Scott Chang
    What do you mean by regular xml document? Are you referring to fact that its missing a root element? if yes it can be added as below
    USE AdventureWorks;
    GO
    SELECT
    p.NameStyle AS "processing-instruction(nameStyle)",
    p.BusinessEntityID AS "Person/@ID",
    p.ModifiedDate AS "comment()",
    pp.PhoneNumber AS "text()",
    FirstName AS "Person/Name/First",
    MiddleName AS "Person/Name/Middle",
    LastName AS "Person/Name/Last",
    EmailAddress AS "Person/Email"
    FROM Person.Person p
    INNER JOIN Person.EmailAddress e
    ON p.BusinessEntityID = e.BusinessEntityID
    INNER JOIN Person.PersonPhone pp
    ON p.BusinessEntityID = pp.BusinessEntityID
    FOR XML PATH('ElementName'),ROOT('RootName');
    replace ElementName and RootName with whatever name you need to set for element as well as the root element
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • IPhoto only accepts date/month/year format for pics?

    I'm trying to add the dates to many old photos that I have in my iPhoto, version 8.1.2.
    Unfortunately, I have many years of photos in there, and I can't remember exact dates of many photos.
    And so I just want to at least put the month and the year. Or sometimes, I'll just remember the year.
    But iPhoto will only let me use a date/month/year format. Odd.
    Is there any way around this?
    Somehow, many of my old photos that have been transfered from old computers have dates assigned to them that are crazy, like 1960....etc.
    I can just make up a date and a month, but that takes more time, and furthermore it will be wrong info.
    I don't want that.
    It seems silly that I can't just put the year alone.
    Any thoughts?
    thank you!

    it also seems like the albums of photos will use the date of the earliest photo in the album, and the newest photo in the album to create a "from" field and a "to" field, in the "info" section at the bottom left of the application, when the Album is highlighted.
    This means that I have to manually correct every single photo in my albums, so that the album date range will read correctly?
    thanks again...

  • Printing Date and time format LR 1.3.1

    I am trying to print photos with date and time information underneath. Choosing "Photo Info" then "Date" allows me access to everything I need, but in the wrong format. The time is showing up as military (24 hr) format and I cannot find where to change this anywhere in Lightroom. Thank you for helping me with this simple question.

    ruminant wrote:
    The computer is about 18 months old, used every day, usually plugged into mains. Does it still seem likely that the pram battery needs replacing? If so, will it be affecting other things too?
    The PRAM battery normally lasts substantially more than 18 months. If you have extended, Applecare, warranty, have Apple look at it. Otherwise, you can either try to change it yourself or have some service shop do it for you. Take a look [righ here|http://www.powerbookmedic.com/Take-Apart-Repair-Manuals-p-1-c-258.html] for more info.
    Besides losing the date and time, other parameters such as the volume, brightness, etc., will also reset to default due to PRAM failure.

  • Independently configure date format for XML/JSON serialization

    How do I configure the date format independently for each of my date fields?
    For example, let's say I have a CustomerOrder class with more than 1 java.util.Date fields in it.
    I need to be able to render like this:
    <customerOrder>
    <orderDate>2013-01-04T20:50:42.769Z</orderDate>
    <user>Bob</lastUpdateUser>
    <state>CO</state>
    <estShipDate>2013-01-04</estShipDate>
    </customerOrder>
    So one of the dates may not care about the hh:mm:ss.
    i.e. I cannot format every date the same way.
    Any ideas?
    This is my technology stack:
    - Tomcat 7
    - Jersey 1.16
    - Enunciate 1.26.2
    - Spring 3.1.2
    - Hibernate 4.1.7
    - JPA 2.0.3

    Otis,
    A "java.sql.Date" contains only a date, whereas a "java.sql.Timestamp" contains both date and time. So retrieve the data (from the database) as a "Timestamp" and not as a "Date".
    Perhaps if you'd care to post the relevant part of your code and show what you are getting and what you want to get, I may be able to help you further.
    Here's a small (uncompiled and untested) example:
    Connection conn = // However you get it.
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select sysdate from dual");
    if (rs.next()) {
      Timestamp ts = rs.getTimestamp(1);
    }Good Luck,
    Avi.

  • Date format for XML

    I have a Date object and I want it to be in the below format before I set it into a Calendar
    2009-10-09T17:00:00Z
    Here's my code
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    How do I do that?
    Thanks

    user8742475 wrote:
    Here's my code
    String dateString = "2011-09-08T00:00:00-0700-07:00";
    SimpleDateFormat dfISO8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    Date dt= dfISO8601.parse(dateString);
    Calendar cal = Calendar.getInstance();
    cal.setTime(dt);
    customObject.setDStartDate(cal); //customObject is a WS object of Oracle CRM On Demand. I downloaded the WSDL and generated the proxy for it. It accepts a Calendar object
    Some possible solutions.
    1. It will also accept something else. I suggest using the SimpleDateFormat to produce a string and use that and nothing else.
    2. It won't accept anything else. Then you are left with the possibility that the WSDL is wrong (somehow) So you find a way to work around it which might include not using the WSDL at all.
    3. Depending on how setDStartDate() works you might be able to create a proxy Calendar class, your own implementation, specifically replacing toString() with a correct format based on SimpleDateFormat.

  • Best Data rate and format for Big Screen Playback

    I am a video producer supplying content for a tradeshow display consisting of 18 flat screens oriented vertically, 8 over 8. Very heavy duty Windows playback machine, with 3 graphics cards, 1 for each set of 6 monitors. The total pixel size is 3240x 1280 px. We have produced a number of full screen and smaller movies that the interactive programmer is trying to intergrate into a Flash program where some videos will play full screen, and others in smaller windows (those were produced in 1920x1080). All videos were mastered at the specified pixel count, square pixels, progressive, and output in Pro Res 422, 44.1K audio. Flash is being used to create the interface, and I am transcoding to .F4V at lower bit rates like 4, 6, and 9 Mbps. They are having trouble playing these movies back smoothly. We have done similar projects in the past with Director without issue. Of course they are blaming the video, I am offering to encode in any format at any data rate they suggest. Can anyone suggest a direction here?

    Are you trying to burn a standard DVD or are you trying to put a QuickTime .mov file on DVD media?
    A standard DVD doesn't worry about file size (only the duration).
    A "data" DVD is limited to the type of media used. A single layer DVD is about 3.7 GB's.
    In order to make a data DVD you need to keep the data rate low enough to not exceed the DVD media playback abilities. They can't handle the higher rates found in many of the preset options.
    You can avoid all of these headaches by telling the viewer to "copy" the .mov file from the DVD to their Desktop. Then nearly any of the presets option will work.
    H.264 is a great video codec and the "automatic" preset should work just fine. Use "multi-pass" for best quality (takes a very long time). Remove the check mark for "Audio" since your file has none. Leave it checked and you waste file size because a silent audio track would be added.

  • How to change date format for xml insert to a view

    We want to accept more than one data format in an XML insert using DBMS_XMLSave.insertXML(insCtx,xmlDoc);
    The two formats are
    6/7/2004 10:47:21 - This is working
    2004-06-08-04:00 - This gives the error
    java.text.ParseException: Unparseable date: "2004-06-08-04:00"'

    Make the column datatype VARCHAR2

  • InfoPath Date Picker - Reversed formats for different users

    Two other users using an InfoPath 2010 form I have published onto SharePoint 2013 on an intranet both experience a mandatory date format of dd/mm/yyyy, whereas I experience mm/dd/yyyy. We are all using IE and have the same version (11.0.9600.17207) with
    the exception of one of the other users (10). Any solutions/possible causes of the problem?

    Hi Linna,
    Please collect information about regional setting in all PC machines’ control panel. InfoPath is client application that might be affected by local regional settings. Also provide the regional setting of your site.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Need help bout a query that will print data in matrix format..

    solved
    null

    SQL> create table mytable
      2  as
      3  select 'pranita' consultant_name, 'manager' designation, 'sohan' salesman from dual union all
      4  select 'pradeep', 'ceo', 'nick' from dual union all
      5  select 'sham', 'developer', 'prasad' from dual union all
      6  select 'john', 'designer', 'sohan' from dual union all
      7  select 'sam', 'developer', 'rajesh' from dual union all
      8  select 'pranita', 'manager', 'sohan' from dual union all
      9  select 'john', 'designer', 'anand' from dual union all
    10  select 'pradeep', 'ceo', 'rohit' from dual union all
    11  select 'sam', 'developer', 'nick' from dual
    12  /
    Tabel is aangemaakt.
    SQL> select consultant_name
      2       , designation
      3       , count(decode(salesman,'sohan',1)) "sohan"
      4       , count(decode(salesman,'nick',1)) "nick"
      5       , count(decode(salesman,'prasad',1)) "prasad"
      6       , count(decode(salesman,'rajesh',1)) "rajesh"
      7       , count(decode(salesman,'anand',1)) "anand"
      8       , count(decode(salesman,'rohit',1)) "rohit"
      9    from mytable
    10   group by consultant_name
    11       , designation
    12  /
    CONSULT DESIGNATI      sohan       nick     prasad     rajesh      anand      rohit
    sam     developer          0          1          0          1          0          0
    john    designer           1          0          0          0          1          0
    pradeep ceo                0          1          0          0          0          1
    sham    developer          0          0          1          0          0          0
    pranita manager            2          0          0          0          0          0
    5 rijen zijn geselecteerd.Regards,
    Rob.

  • AD 11g Trusted Recon is failing due to invalid Date format for Start Date

    We are using OIM 11g with AD 11g connector.
    we have mapped "whenCreated" attribute of AD to "Start Date" in OIM. We ran Trusted Recon, the recon failed due to invalid date format.
    we got the following error :
    Caused By: oracle.iam.reconciliation.exception.InvalidDataFormatException: Invalid data - 10/19/2012 10:33:30 AM against Date format yyyy/MM/dd HH:mm:ss z for key Start Date
    at oracle.iam.reconciliation.impl.ReconOperationsServiceImpl.convertReconFieldsToOIMFields(ReconOperationsServiceImpl.java:1610)
    at oracle.iam.reconciliation.impl.ReconOperationsServiceImpl.ignoreEvent(ReconOperationsServiceImpl.java:548)
    at oracle.iam.reconciliation.impl.ReconOperationsServiceImpl.ignoreEvent(ReconOperationsServiceImpl.java:535)
    at sun.reflect.GeneratedMethodAccessor9326.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at oracle.iam.platform.utils.DMSMethodInterceptor.invoke(DMSMethodInterceptor.java:25)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    Thanks.

    Caused By: oracle.iam.reconciliation.exception.InvalidDataFormatException: Invalid data - *10/19/2012 10:33:30 AM* against Date format yyyy/MM/dd HH:mm:ss z for key Start Date
    Error is because of invalid date format.
    You need to bring data in required format. As I remember you can configured it in one of the AD configuration lookup.

  • How to append date in YYYYMMDD format in .par file for export

    Hi,
    Database Version: 10.2.0.4
    OS: AIX
    I have an export script which reads .par file and executes "exp" to export schema.
    I would like to add date in "YYYYMMDD" format for the dump file like this
    owner=scott file=/exports/scott_${`date '+%Y%m%d'`}.dmp feedback=10000
    I know above statement will not help, but I am giving it as example on what I want to achieve.
    I want the file name as =/exports/scott_20120712.dmp
    Thanks
    Sarayu

    user13312943 wrote:
    Hi,
    Database Version: 10.2.0.4
    OS: AIX
    I have an export script which reads .par file and executes "exp" to export schema.
    I would like to add date in "YYYYMMDD" format for the dump file like this
    owner=scott file=/exports/scott_${`date '+%Y%m%d'`}.dmp feedback=10000bcm@bcm-laptop:~$ export YYYYMMDD=`date '+%Y%m%d'`
    bcm@bcm-laptop:~$ echo $YYYYMMDD
    20120712
    bcm@bcm-laptop:~$
    owner=scott file=/exports/scott_${YYYYMMDD}.dmp feedback=10000

  • [Access 2010] Change default formats for data types

    Whenever I import data, the default format for Boolean data types is "-1,0." I know how to subsequently change this format to "Yes/No," but I'd like to change the default
    setting to "Yes/No." Is this possible?
    Thanks in advance.

    Hi,
    I found you post the same question in other place and got the advice. I agree with Mr. Kees suggestion. The data type is a build-in default setting with Access, we can't change it. We may try the workaround via VBA to test.
    http://forums.cnet.com/7723-6129_102-627633/access-2010-change-default-formats-for-data-types/#message5617496
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Have a good time.
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Date of required availability of a purchasing order

    Hi,
    Is there a way to get the date of required availability for a list of purchasing orders (PO)? 
    What I'd like to do is extract the list of all open POs with the date they are required for production to see if they are late or not.  I'm not talking about the PO delivery date that was agreed with the supplier. I'm talking about the date the material in the PO is required in order not to delay the production.
    I know that I can see the date of required availability of a material in MD04 but it's only one material at a time and not really good to do reporting. 
    Thanks

    Xirpinu,
    Unless you are using MTO for both the parent and the component, the only way to determine the requirements date for a given Purchase order would be through a calculation, which you would have to develop.
    Rather than try to create this calculation, and then commit it to a report, why not use the tool that was intended to manage this issue - MD06.
    If you execute MD06, and select exception group 7, you can find all exception messages for a material that would require you to pullin (msg 10), pushout (msg 15), or delete a purchase order (msg 20).  For your purchased parts, this would be the ones in which the requirements date/qty is inconsistent with the Purchase order delivery date/qty.  If it became necessary to determine the requirements date, MD06 supports branching directly to MD05, where you can apply whatever logic you wish to determine the requirements date.
    Best Regards,
    DB49

  • Change "date and time"  format in the server.

    i would like to change the "time and date format" to european format from the current default(US) format in the serever.
    Server is on windows XP. if i make the changes to control panel in the server, then too the changes are not reflected.
    do i need to make a change in the SAP engine config?
    nikhil

    hi nikhil,
    go to su01 T-code and type the name for which u want to change the date and time settings as u require go to change mode and then click on defaults tab theer eu can find ur required format for time and date settings. I hope this will help u.
    regards,
    bharath kumar. k

Maybe you are looking for

  • [SOLVED] X11 hid support broken on fresh macbook install

    Hi! The solution was elementary indeed, I was missing xf86-input-keyboard and xf86-input-mouse. (looooooooooool) What bugs me though, is how this could happen to an already working system. From what I remember I didn't touch those drivers on my previ

  • IMovie quit's unexpectedly since upgrade to 10.10

    Since upgrading to OSX 10.10 from Mavericks, on a late 2012 Mac Mini (2.3 GHz i7, 4GB Ram) iMovie will now quit unexpectedly on every load after a few seconds. It appears to be attempting to convert my iMovie Library but this process never completes

  • Flash Media Server Temp Files

    Hi all, Maybe this topic has been asked and answered before. But I have not found relevant information on this issue. So there it is: I found out that when the FMS service is running, it creates a lot of temporily files in the c:\windows\tempdirector

  • How could I do a gallery within a gallery?

    Basically I want a want a large content box with 6 smaller boxes beneath it. Clicking any of the smaller boxes will bring up a different gallery in the large content box. I think I want to use jquery sliders for each the gallery but i don't really kn

  • Spotty Internet Connection

    I was having trouble with my internet connection becoming very sporadic recently. I wonder what happened. I called Comcast and they said your Modem (Motorola Docsis 3.0 compliant Modem, Brand new) is dropping in and out and we will send the techs to