Sum Fields based on change in another field

I have data that looks like this
<Records>
<VBLEN>123</VBLEN>
<MATNR>012356</MATNR>
<ZSPR>1.02</VBLEN>
</Records>
<Records>
<VBLEN>123</VBLEN>
<MATNR>568954</MATNR>
<ZSPR>2.05</ZSPR>
</Records>
<Records>
<VBLEN>856</VBLEN>
<MATNR>259865</MATNR>
<ZSPR>5.98</ZSPR>
</Records>
<Records>
<VBLEN>856</VBLEN>
<MATNR>359874</MATNR>
<ZSPR>4.12</ZPSR>
</Records>
<Records>
<VBLEN>856</VBLEN>
<MATNR>985698</MATNR>
<ZSPR>1.06</ZSPR>
</Records>
In my output, I have a field on every line that is a total. So My output needs to look like this.
<Records>
<VBLEN>123</VBLEN>
<MATNR>012356<MATNR>
<ZSPR_TOTAL>3.07</ZSPR_TOTAL>
</Records>
<Records>
<VBELN>123</VBLEN>
<MATNR>568954</MATNR>
<ZSPR_TOTAL>3.07<ZSPR_TOTAL>
</Records>
<Records>
<VBLEN>856</VBLEN>
<MATNR>259865</MATNR>
<ZSPR_TOTAL>11.16</ZPSR_TOTAL>
</Records>
<VBLEN>856</VBLEN>
<MATNR>359874</MATNR>
<ZSPR_TOTAL>11.16</ZSPR_TOTAL>
</Records>
<Records>
<VBLEN>856</VBLEN>
<MATNR985698</MATNR>
<ZSPR_TOTAL>11.16</ZSPR_TOTAL>
So I need the sum of ZSPR on each line, but it has to be the sum of ZSPR for each instance of VBLEN.

Hi Dave,
If you are using below graphical mapping logic , you have to apply some logic (shown below ) for remaining fields of output.
For getting Total sum  value based on VBLEN :
For arranging remaining fields of output xml :
Note : ZSPR_TOTAL is mentioned as Total.
Thanks
Hari.

Similar Messages

  • Conditional Extract (based on changes in another table)

    Hi guys,
    I have a question for nightly (incremental) loads. I want to select from certain tables even if there are updates to another table.
    For example, I nightly pull any changes (or new records) from table 1, 2, 3, 4, & 5.
    But, if table 1 has no changes, I still want to pull matching records from it if there are changes to any of the others.
    And similarly, I want to pull matching records from table 2 if there are changes to any of the others.
    Assume that the Last_update field is available in the source tables. (This is necessary for pulling key columns to match for updates.)
    Thanks.

    can you explain in details .?

  • Access 2013: Sum fields on a form suddenly showing up blank

    I have a simple Access database (originally built in 2010, now running 2013). Sometime in the last week or so all of the SUM fields in the database started showing up BLANK (one minute everything was working fine, the next it wasn't, not sure what happened
    in between). Even when I create a new, basic form, I can't seem to get my SUM fields working.
    For example, I have a table where I document number of miles traveled for work purposes, the fields include: TravelDate, ProjectID, Mileage, and Description. Mileage is a Number field, Long Integer. If I create a continuous form, connect it to the table
    (same thing happens if I connect to a query), add a field in the Detail section with
    Mileage as control source and txtMileage as name and a field in the FORM FOOTER that is: =Sum([txtMileage])...the SUM field is empty in
    Form View. And, there are no NULL values in the data set. This is happening across all of my forms and subforms, all SUM fields are now displaying as blank.
    Is it possible that I changed a global Access setting to cause this? A form setting? Any other ideas?
    Thanks!
    Laura

    I had the same sudden issue. But I was able to determine that it involved only one workstation. All the others were fine, as well as a test run on another Win 8 station outside the environment. From there I was able to determine that  a third party
    app had been installed near the time of the problem showing up. I uninstalled it and it immediately was resolved. The app was a C# based tool thought the authors have yet to identify why this caused a problem. My suspicion is that they wrote a 32 bit version
    and this was installed on a 64 bit station, and there is some issue with mso.dll, where I believe the function calls exist for sum. I am testing to see if there are similar function errors in Excel.
    What is noticeable was that Access did not throw a an Error# nor a #name. Just nothing appeared, and when you click on a row, the sum would appear, though it was incorrect.
    In Access 2010 I remember there were some footer field issues in continuous which eventually were patched.
    It was an opportunity to remind my client - do not install anything from any one on the live system without prior testing.

  • How to truncate a decimal to 2 places of a sum field

    Hi Everyone,
    Hope all is well,
    When exporting the query to excel, a GPA with 2 digit decimal is showing in Excel with 9 digits past the decimal.
    Wanted to truncate the decimal to 2 positions in disco.
    so did: TRUNC(SUM(Overall Lgpa Gpa),2) bec query is using the sum field
    the sum field shows: .89 and the above calc shows .88
    i tried putting ROUND around the above like this ROUND(TRUNC(SUM.....))
    and got a data type error....
    Your ideas and advice would be appreciated, tx.... sandra

    Hi Everyone,
    think i answered the question, can you pls confirm:
    ROUND(( TRUNC(SUM(Overall Lgpa Gpa),3) ),2)
    i realize
    - i need to show 3 decimal places if i want to round up
    - round needed the number of places parm, which i left out
    tx, s

  • What is the difference between   nvl(sum (field), 0) & sum(nvl (field,0)) ?

    What is the difference between nvl(sum (field), 0) & sum(nvl (field,0)) ?
    For the below table data i don't see any different in results
    CREATE TABLE FRUITS
    TYPE VARCHAR2(10 BYTE),
    VARIETY VARCHAR2(10 BYTE),
    PRICE NUMBER(18,2)
    TYPE     VARIETY          PRICE
    apple     gala          2.79
    apple     fuji          0.24
    apple     limbertwig     2.87
    orange     valencia     3.59
    orange     navel          9.36
    pear     bradford     7.77
    pear     bartlett     7.77
    cherry     bing          2.55
    cherry     chelan          6.33
    pear     bradford     
         navel          6.39
    select variety, nvl(sum(price),0)
    from fruits
    group by variety;
    VARIETY     NVL(SUM(PRICE),0)
    limbertwig     2.87
    bartlett     7.77
    bing     2.55
    marathon     0
    gala     2.79
    fuji     0.24
    navel     15.75
    bradford     7.77
    chelan     6.33
    valencia     3.59
    select variety, sum(nvl(price,0))
    from fruits
    group by variety;
    VARIETY     SUM(NVL(PRICE,0))
    limbertwig     2.87
    bartlett     7.77
    bing     2.55
    marathon     0
    gala     2.79
    fuji     0.24
    navel     15.75
    bradford     7.77
    chelan     6.33
    valencia     3.59
    no difference in output.
    what is the difference?
    Thanks in advance

    Do you see the difference now?
    PRAZY@11gR1> create table testing(field number);
    Table created.
    Elapsed: 00:00:00.10
    PRAZY@11gR1> insert into testing select null from dual connect by level<=5;
    5 rows created.
    Elapsed: 00:00:00.00
    PRAZY@11gR1> select * from testing;
         FIELD
    Elapsed: 00:00:00.01
    PRAZY@11gR1> select sum(nvl(field,1)) from testing;
    SUM(NVL(FIELD,1))
                    5
    Elapsed: 00:00:00.00
    PRAZY@11gR1> select nvl(sum(field),1) from testing;
    NVL(SUM(FIELD),1)
                    1
    Elapsed: 00:00:00.00In the former, we are substituting 1 to null value and summing-up. hence we got 5. in the later, we are summing-up the null, which is null and substituting 1 if the result is null. so we got 1.
    Regards,
    Prazy

  • Formating a SUM-Field

    Hi,
    I want to format a number. When I format a normal field, it works.
    expression: <?GEHALT_MON11?>
    formatmask (MS): #.##0,00 €;(#.##0,00 €)
    But when I format a SUM-Field, it does not work. The result is not formatted.
    <?sum(current-group()//GEHALT_MON11)?>
    formatmask (MS): #.##0,00 €;(#.##0,00 €)
    I alternatively tried formating with the oracle formatmasks - it also didn't work on the SUM-Field.
    Why?
    thank you,
    Tobias

    Hi Tobias,
    To use the Oracle format mask or the Microsoft format mask, the numbers in your data
    source must be in a raw format, with no formatting applied (for example: 1000.00). If the
    number has been formatted for European countries (for example: 1.000,00) the format
    will not work.
    If you want to use Oracel format-mask , use this
    <?format-number:sum(TOTAL_PAID_DAYS_AMOUNT);’999G990D00’?>
    I think better , you can put the part of xml here

  • =SUM(IIF(Fields!OPTION_CODE.Value="M","0",Fields!COST.Value * Fields!TOTAL_UNITS.Value )) =IIF(Fields!OPTION_CODE.Value="P","0",SUM(Fields!COST.Value * Fields!TOTAL_UNITS.Value )) =SUM(IIF(Fields!OPTION_CODE.Value="M",CDbl(Fields!COST.Value * Fields

      in this i want to calculate only Option code 'M' Amount in gross total.BUT MY Gross total calculating M and P Amount.  option code P value should visible but not to add.
    please any body help me to writing any function
    =SUM(IIF(Fields!OPTION_CODE.Value="M","0",Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
    iam writing like below its showing error
    =SUM(IIF(Fields!OPTION_CODE.Value="M","0",Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
    =IIF(Fields!OPTION_CODE.Value="P","0",SUM(Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
    =SUM(IIF(Fields!OPTION_CODE.Value="M",CDbl(Fields!COST.Value * Fields!TOTAL_UNITS.Value), CDbl(0,0)

    Hi Pullela venu,
    I have checked the expression and found that you have incude the string "0" in the SUM function which will cause the error, please remove the "" of the value 0 as below to have a test:
    =SUM(IIF(Fields!OPTION_CODE.Value="M",0,Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
     =IIF(Fields!OPTION_CODE.Value="P",0,SUM(Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
    For the last expression as below is not correct, CDBL function format is CDBL(expression):
    =SUM(IIF(Fields!OPTION_CODE.Value="M",CDbl(Fields!COST.Value * Fields!TOTAL_UNITS.Value), CDbl(0,0)
    Modify as below:
    =SUM(IIF(Fields!OPTION_CODE.Value="M",CDbl(Fields!COST.Value * Fields!TOTAL_UNITS.Value), CDbl(0.0) )
    If the problem still exists, please provide the error message if the expression throw any error.
    Any problem, please feel free to ask.
    Regards
    Vicky Liu

  • How to display data from a recordset based on data from another recordset

    How to display data from a recordset based on data from
    another recordset.
    What I would like to do is as follows:
    I have a fantasy hockey league website. For each team I have
    a team page (clubhouse) which is generated using PHP/MySQL. The one
    area I would like to clean up is the displaying of the divisional
    standings on the right side. As of right now, I use a URL variable
    (division = id2) to grab the needed data, which works ok. What I
    want to do is clean up the url abit.
    So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end all
    I want is clubhouse.php?team=Wings.
    I have a separate table, that has the teams entire
    information (full team name, short team, abbreviation, conference,
    division, etc. so I was thinking if I could somehow do this:
    Recordset Team Info is filtered using URL variable team
    (short team). Based on what team equals, it would then insert this
    variable into the Divisional Standings recordset.
    So example: If I type in clubhouse.php?team=Wings, the Team
    Info recordset would bring up the Pacific division. Then 'Pacific'
    would be inserted into the Divisional Standings recordset to
    display the Pacific Division Standings.
    Basically I want this
    SELECT *
    FROM standings
    WHERE division = <teaminfo.division>
    ORDER BY pts DESC
    Could someone help me, thank you.

    Assuming two tables- teamtable and standings:
    teamtable - which has entire info about the team and has a
    field called
    "div" which has the division name say "pacific" and you want
    to use this
    name to get corresponding details from the other table.
    standings - which has a field called "division" which you
    want to use to
    give the standings
    SELECT * FROM standings AS st, teamtable AS t
    WHERE st.division = t.div
    ORDER BY pts DESC
    Instead of * you could be specific on what fields you want to
    select ..
    something like
    SELECT st.id AS id, st.position AS position, st.teamname AS
    team
    You cannot lose until you give up !!!
    "Leburn98" <[email protected]> wrote in
    message
    news:[email protected]...
    > How to display data from a recordset based on data from
    another recordset.
    >
    > What I would like to do is as follows:
    >
    > I have a fantasy hockey league website. For each team I
    have a team page
    > (clubhouse) which is generated using PHP/MySQL. The one
    area I would like
    > to
    > clean up is the displaying of the divisional standings
    on the right side.
    > As of
    > right now, I use a URL variable (division = id2) to grab
    the needed data,
    > which
    > works ok. What I want to do is clean up the url abit.
    >
    > So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end
    > all
    > I want is clubhouse.php?team=Wings.
    >
    > I have a separate table, that has the teams entire
    information (full team
    > name, short team, abbreviation, conference, division,
    etc. so I was
    > thinking if
    > I could somehow do this:
    >
    > Recordset Team Info is filtered using URL variable team
    (short team).
    > Based on
    > what team equals, it would then insert this variable
    into the Divisional
    > Standings recordset.
    >
    > So example: If I type in clubhouse.php?team=Wings, the
    Team Info recordset
    > would bring up the Pacific division. Then 'Pacific'
    would be inserted into
    > the
    > Divisional Standings recordset to display the Pacific
    Division Standings.
    >
    > Basically I want this
    >
    > SELECT *
    > FROM standings
    > WHERE division = <teaminfo.division>
    > ORDER BY pts DESC
    >
    > Could someone help me, thank you.
    >

  • Forms: avoiding "record changed by another user"

    I have a form with a DB block. There is also a DB trigger on the same table, so when an update is performed in the form, the BEFORE UPDATE trigger updates the same row. Of course, when I try to change the same record again, I get "record changed by another user". I know that there is a property somewhere in Forms that will re-synchronise the Form state with the DB state, but I can't find it in the online docs.
    Can anyone tell me where to find this property, or what buil-tin to call (if appropriate)?

    Hi Chris.
    There is no build-in or property do this. You have to select the current data from the database, because the data in your form is not up-to-date.
    So what do you have to do.
    If your form do not manipulate the fields that the DB-trigger manipulate, simply remove the fields from your form.
    Otherwise, if you need the field in your form you must get the newest value from the DB, because it has changed. It make sence.
    BR Claus T. Rasmussen
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Chris Webster:
    I have a form with a DB block. There is also a DB trigger on the same table, so when an update is performed in the form, the BEFORE UPDATE trigger updates the same row. Of course, when I try to change the same record again, I get "record changed by another user". I know that there is a property somewhere in Forms that will re-synchronise the Form state with the DB state, but I can't find it in the online docs.
    Can anyone tell me where to find this property, or what buil-tin to call (if appropriate)?<HR></BLOCKQUOTE>
    null

  • Can a button change to another state and remain there, and also go to a URL?

    Hi --
    I've been wracking my brain and scouring the internet since yesterday to find a solution to this...It seems easy enough, but I'm at a loss...maybe I'm over thinking it and it's simply not possible?
    We have a button that we want to, when clicked, change to another state, remain there, and also use a navto to go to another page within the publication...is this possible?
    We've tried doubling up the actions of the button, using fake buttons, etc. all without success. What we have it at now is...you can tap to navto, and the button does change, but it reverts back to it's previous state in that moment between releasing the button and actually jumping to the page we want it to go to.
    The only explanation I've come up with is based on the information on this page: http://help.adobe.com/en_US/digitalpubsuite/using/WS67cb9e293e2f1f60-8ad81e812b10bfd837-80 00.html -- that because the two actions I want to accomplish fall into the two different categories: Supported actions for hyperlink buttons and Supported actions for slideshow buttons, that this simply isn't possible?
    Your help is greatly appreciated!
    Thanks,
    Kristina

    No, that's not supported with multiple actions. You can't switch a state and then jump to another document.

  • "The file [name of file] may have been changed by another user since you last saved it." Issue affects both network and local files.

    When a certain user saves a file in Excel 2010, she gets a message: "The file <name of file> may have been changed by another user since you last saved it."  She can choose to save as another file or overwrite with her changes. 
    This just started happening a week or so ago.  She was concerned that someone else was accessing her files, but we did several tests that opened, made a change and saved in a matter of seconds, and she still gets the message.  It happens on
    most files, but not all – both network and local.
    We already tried the QFE_Saskatchewan registry fix.  I also checked the file server for Services for Macintosh.

    You may be confused by the error in Excel saying “another user”. Actually Excel cannot tell who (the real human) is editing the file. Based on my research the No.1 possibility of the error is KB2626998.
    2626998  Connection to a network document is lost in the 2007 Office system or in Office 2010 after the computer resumes from standby
    http://support.microsoft.com/kb/2626998
    For Excel 2010, follow these steps:
    a.  Click Start , click Run , type regedit in the Open box, and then click OK .
    b.  Locate and then select the following registry subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options
    c.  On the Edit menu, point to New , and then click Dword Value .
    d.  Type NetworkAvailableTimeInSeconds , and then press Enter.
    e.  Right-click NetworkAvailableTimeInSeconds , and then click Modify .
    f.  In the Value data box, click Decimal , type a number value, and then click OK .
    Note This registry subkey sets the time, in seconds, that Excel waits for the network to resume. For example, if you type 15 for the number value, Excel waits 15 seconds for the network to resume. You might have to do some tests in your own environment to
    determine an appropriate value. You may have to try multiple numbers.
    g.  Locate and then select the following registry subkey.
    HKEY_CURRENT_USER\Software\Microsoft\office\14.0\common\Internet
    h.  Repeat step 2C through step 2F again. Reuse the same value that you used previously.
    i.  Exit Registry Editor.
    Feel free to post back. Thanks.
    Cheers,
    Tony Chen
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please contact
    [email protected]

  • Hostname in Terminal changed to another user

    Hi,
    I'm having an issue where I open terminal and my computer name has changed to another persons name on our network. Does anyone know why this is happening and how to fix it?

    BobHarris wrote:
    Weird I see your responses in my email, but not here ...
    The forum server is a bit overwhelmed from all the iOS 7 traffic
    The local forum software has been having some issues, and (based on some offline discussions) the Apple folks are aware and are working on the underlying issues, and (as BobHarris mentions) the added load of the iOS 7 traffic likely isn't helping.
    BobHarris wrote:
    I cleared the device list on the router and restarted it and I see that the router recognizes and stores the names for my iPad, AppleTV and my Android phone, but not for my MacBookPro. That device name is set to unknown and then some number.
    Give your Macbook Pro a DHCP Client ID
    System Preferences -> Network -> Advanced -> TCP/IP -> DHCP Client ID
    Not sure that'll help?   Certainly try it, but.. what you're getting is the "who am I?" response your Mac gets from your local DNS services, which can be provided by software within the router, or software upstream from the router.   The prompt just displays the settings.  You can reboot, and that won't help.  If you're getting a weird setting for the local DNS queries, then you can either chase after the setting in the router or upstream with your ISP, or (probably easier) simply change your prompt string as I'd linked to and as BobHarris has indicated.  (Or install OS X Server or such, and run your own local DNS services, but that's the gonzo approach.)

  • Can I assign a task based on information from another column?

    For example:
    Let's say I have a column called "Question Type" and this column has multiple checkbox choice, those being:
         Math
         Science
         History
         English
         Other
    I want to allow users to be able to select multpile catagories for the question, like making one both math and science (which right now is completely possible)
    I then want another column that says who the problem is assigned to. Bob is good at math, Joe at science, Jill at histroy, Jenn at English, and Billy handles everything else.
    1) Is there a way that the task can be automatically assigned to my math expert Bob when I specify that the item I am adding is a math problem?
    2) If I make a problem both math and science, can the task be assigned to both Bob and Joe?
    Thanks in advance!

    Hi,
    According to your post, my understanding is that you wanted to assign a task based on information from another column.
    To assign task to multiple users, you need to:
    Create a workflow and add action: Start Approval Process.
    Click these user, select the Group, change One or a time(serial) to
    All at onec(paralle).
    Right click the action, select Properties, click ExpandGroups, change No to
    Yes.
    Then you can assign task to each member of the group.
    I recommend to follow the steps as below to achieve what you want:
    Create a custom list, add columns: Question Type(Choice); Assigned to(Person or Group).
    Create a workflow associated the list.
    Add conditions and action as below:
    Then the task can be automatically assigned to 123 when the item is a math problem.
    In addition, if you make a problem both math and science, the task can be assigned to both 456 and 789.
    You can add other conditions to satisfy all the requirements.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • "Network settings have be changed by another application" stuck in loops

    I have the exact problem as others with Network System Preferences saying that the settings have been changed by another application. The message goes into a loop that can only be stopped with a Force Quit of the Preferences. I also have the Airport not connecting at start-up without choosing the Network Name from the Airport Pull down menu. I also think it may have started with the last Security upgrade and Java upgrade. I have used the airport utility to reconfig the base station. I discovered a system keychain with a password for the airport that my normal passwords would not open to show what it's password was. I have done many disk permissions and verifications. Any ideas? I would think if this is a Security update error, that Apple would be aware of it by now and post a repair. I have followed some threads on this issue but would rather wait for an Apple fix. There appears to be no way to contact Apple in customer support.

    A Fix for "Your network preferences have been changed by another application" Error
    In the Library/Preferences/SystemConfiguration/ folder delete the following:
    com.apple.airport.preferences.plist
    NetworkInterfaces.plist
    preferences.plist
    com.apple.nat.plist
    You will have to re-configure all your network settings since deleting these files will cause them to be returned to defaults.

  • Problem with internet. When i open System preferences, Network, message drops down: 'your network settings have been changed by another application'. I click OK, but it drops a message again and again, preventing me to do anything about the setting.

    Problem with internet. When i open System preferences, Network, message drops down: 'your network settings have been changed by another application'. I click OK, but it dropps the message again and again, preventing me to do anything about the setting.

    A Fix for "Your network preferences have been changed by another application" Error 
    In the Library/Preferences/SystemConfiguration/ folder delete the following:
    com.apple.airport.preferences.plist
    NetworkInterfaces.plist
    preferences.plist
    com.apple.nat.plist
    You will have to re-configure all your network settings since deleting.
    (10.4.10)
    Use Software Update to update your OS to last version of Tiger.  Install all the other updates that goes along w/it.

Maybe you are looking for

  • Itunes doesn't play songs, help me please

    hi guys, i'm an italian boy. my itunes doesn't play any songs that i have; when i click on one song the little blue loudspeaker appears but the song doesn't start. this problem began to exist when i downloaded the latest version of itunes (6.0.5, i t

  • Need help with 'unable to open executable ... ' error

    After I compile I get this error. Here is the entire error msg: == error: unable to open executable '/Users/..MyName../Library/Developer/Xcode/DerivedData/BallsAway-dxopkhiuo..... .zemqfcgnldx/Build/Products/Debug-iphonesimulator/BallsAway.app/BallsA

  • What is the proper way to apply SCCM 2012 R2 Cumulative Updates

    Hello All! I am looking for a little advice. Since deploying SCCM 2012 R2 I have not yet installed any of the cumulative updates. What is the proper way to install the previusely released updates? I believe there has been 3 CU relases since SCCM 2012

  • Question on compound clips

    The new behavior of compound clips starting in 10.0.6 does not work for me as I thought I understood it. I added a still clip to the timeline and attached a second still clip to it. I then created a compound clip which was fine. I then added a depth

  • Calendar: Can you add an event for just 'NEXT' week?

    Often I'll need to repeat an event next week at the same time. In iOS calendar, there are options to repeat an event Every Day, Week, 2 weeks, month and year. I would like to repeat an event Next Week Is there no way to simply way to do this without