HTMLClient: Sum of products in child records

Hi All,
Scene:
I have a table called Jobs with a field called JobTotal. I have another table called Products which has fields - Description and Price. I have a third table to enable a multiple/multiple relationship called
JobProductMappings with multiple:1 links to Products and multiple:0/1 to Jobs.
Problem:
I would like to display the total cost of the job of the products linked to the job. I've been having a few issues working this out so if anyone has any suggestions they would be welcomed :)
Cheers,
Adam

Computed properties in the LS HTML client have been discussed many times here on the forums, and there are several approaches.  The previous post mentioned probably the most helpful treatment on the subject found at Michael's website (although the code
that is listed is not useful for the HTML client and can be ignored):
http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/185/Computed-Properties-With-the-LightSwitch-HTML-Client.aspx
HTML client computed properties that involve data across relationships and tables, such as yours, are typically more involved to code. Michael has shown how to manage the difficulties using WCF RIA services.  Using the Flower Shop project as a base,
I'll point out a third way to do the same thing as a RIA class, or at least the essential part, namely retrieving an anonymous type as a projection at the server, using JayData.
First, starting the the ComputedValuesHTMLClient2013 project, NuGet package manager is used to add JayData to the project.
Next, using the included JaySvcUtil.exe program, the entity data model file is auto-generated. Both JayData.js and the generated model JS file are added to the default.htm script list.
In the Main Screen, a global variable to hold the FlowerShop database is created and the JayData connection to the LightSwitch database is initialized:
var FlowerShopDb = window.FlowerShopDb || {};
myapp.Main.created = function(screen) {
// Write code here.
FlowerShopDb = new LightSwitchApplication.ApplicationData({
name: 'oData',
oDataServiceHost: '/ApplicationData.svc'
$.when(FlowerShopDb.onReady())
.then(function() {
console.log(FlowerShopDb);
On the BrowseFlowerShopOrders Screen, a custom control named "Total Order Price" will be added to the Flower Shop Orders list, right above Order Date.  In the _render method, there is:
myapp.BrowseFlowerShopOrders.TotalOrderPrice_render = function (element, contentItem) {
// Write code here.
element.innerHTML = '<div id="TotalOrderPriceDiv"></div>';
Now for JayData to make short shrift of this. In the Flower Shop Order (item) Columns Layout--the row template control, the following will go in the _postRender method:
myapp.BrowseFlowerShopOrders.RowTemplate_postRender = function(element, contentItem) {
// Write code here.
FlowerShopDb.FlowerShopOrderDetails
.filter("it.OrderDetail_Order === this.OrderId", { OrderId: contentItem.data.Id })
.map(function(order) {
return {
ProductPrice: order.FlowerShopProduct.Price,
Quantity: order.Quantity
.toArray(function(orders) {
var orderTotal = 0;
orders.forEach(function(o) {
orderTotal += o.ProductPrice * o.Quantity;
$('#TotalOrderPriceDiv', element).text('$' + orderTotal);
Briefly, the Flower Shop Order Id is used as the filter to pull up the corresponding FlowerShopOrderDetail (via EF's OrderDetail_Order navigation property). The anonymous projection pulls up the corresponding price and quantity of the Flower Order details (again
across navigation properties at the server), and stores it in an array orders. Next, it iterates through the orders array, multiplying price and quantity and aggregating to a variable
orderTotal.  Finally, once the server has returned all the values and calculations are complete, the result is displayed in the Total Order Price custom control field.

Similar Messages

  • Problem of orphan child records

    Hi
    I am working on Oracle 8i DB. The production database contians around 100 tables.About 60% tables are interrelated by referential integrity . However , there are some records found which are not such that child records are present without parent records .These occurs when some procedure handles some exception .
    Can I right some user procedure which can scan the schema and found child records which are orphan and user can be tld to correct ones.
    Prashant

    yes of course.
    Example:
    I have a table t_consumer with emp_id and location as pk with other fields.
    I haev one more table t_locations with location as pk.
    The tables are related that emp_id table location must be present in t_locations.
    However due to some constraints disablement during some ddl , some records in t_emp table are having location which does not exists in table t_location.
    There are about 100 tables in product DB with around 40000 records in each. I have to find records with such mismatch.
    Prashant

  • PL/SQL  on delete cascade..   ( how  to view the child record deleted..?)

    Hai
    i have 70 tables integrated with foreign and child key constraints. i have on delete cascade for all the child tables. if i delete the parent table automatically child table record get deleted.
    Kindly tell me how can i check howmany child record has been deleted ..? how can i monitor this...?
    one thing i can do... i can make count of child table before and after...
    is there anyother way..?
    S

    Peter,
    I subscribe to the general consensus around trigger usage. Allthough I allways diffentiate between triggers that,
    - perform pl/sql with embedded DML (that is: delete, insert, update)
    versus triggers
    - that perform pl/sql with embedded queries only.
    The latter use of triggers is good (in my opinion), and most frequently used to enforce (non declarable) data integrity constraints.
    The former use of triggers is bad. Because it makes things happen automagically.
    Just google "asktom triggers are evil", you'll find statements such as:
    ~quote
    because things happen automagically
    because side effects are bad
    because explicit linear code is more maintainable then "happens as a by product of something in the background"
    magic should be avoided. Experience tells me this.
    ~quote
    And to me a CASCADE DELETE clause on a foreign key definition, is a TRIGGER. Allbeit not one for which you had to write CREATE TRIGGER statements, but one that you can declaratively introduce. And this trigger holds embedded DML, it is of the former case, and is therefor bad.
    You the designer of the application may be aware that you have your FK's as cascade delete. But your successor(s) might not be aware of this when they write maintenance code to delete Orders. They might be expecting the database to throw them an FK violation message when they try to delete an Order that still has Lines attached to it.
    Everybody knows the effect of an INSERT, a DELETE, an UPDATE. But the moment you've introduced triggers with embedded DML in them, the effect of these three well known primitive SQL statements suddenly becomes unknown. With triggers you can create any effect for any of these three primitives, that you want. And more often than not other people maintaining your codebase later on in the future, do not realize these side effects happen, because they didn't check the presence of any triggers, nor investigated the side effects caused by them.
    Btw. for exactly the same reasoning I consider use of DEFAULT-clause on table columns, or even use of (fixed length) CHAR datatype, evil also. Again they are in effect declarative triggers with side effects. Allbeit that their side effects usually are less worse than those caused by handwritten triggers with embedded DML.
    Toon

  • Finding the complete hierarchy of all child records for a given root

    Hi,
    We need to find the hierarchy starting from a given root by exploding the hierarchy of each child present in the hierarchy.
    Consider a data as given below.
    Seq_no denotes a primary key.
    Child_id denotes the child node in the hierarchy
    Parent_id indicates the immediate parent of the child record
    Root_id denotes the starting point of the hierarchy.
    Within a given hierarchy the root_id will remain the same and parent_id will keep on changing as required.
    Seq_No Child_id     Parent_id     Root_id
    101          1          NULL     1
    102          2          1          1
    103          3          2          1
    104          4          1          1
    105          5          3          1
    106 4 NULL 4
    107 7 4 4
    108 8 4 4
    109 9 7 4
    110 3 NULL 3
    111 4 3 3
    112 5 3 3
    The requirement is to pull the hierarchy starting from a given root traversing down the path by exploding the hierarchy of each and every child present in that hierarchy. It is explained using below example.
    For root_id value as 4, the expected o/p is
    child_id path
    7 /7
    9 /7/9
    8 /8
    For root_id value as 3, the expected o/p is
    child_id path
    4 /4
    7 /4/7 ---> Hierarchy with root_id 4 gets exploded
    8 /4/8
    9 /4/7/9
    5 /5
    For root_id value as 1, the expected o/p is
    child_id path
    2 /2
    3 /2/3 ---> Hierarchy with root_id 3 gets exploded
    4 /2/3/4 ---> Hierarchy with root_id 4 gets exploded
    7 /2/3/4/7
    9 /2/3/4/7/9
    8 /2/3/4/8
    5 /2/3/5
    4 /4
    7 /4/7
    8 /4/8
    9 /4/7/9
    5 /5
    5 /2/3/5
    Also, additionally, if there exist any cyclic child records in the hierarchy, the exploding should stop there itself.
    CREATE TABLE xyz
    SEQ_NO NUMBER,
    ITEM_ID NUMBER,
    PARENT_ITEM_ID NUMBER,
    ROOT_ITEM_ID NUMBER
    Insert into xyz
    (SEQ_NO, ITEM_ID, ROOT_ITEM_ID)
    Values
    (1, 1, 1);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (2, 2, 1, 1);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (3, 3, 1, 1);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (4, 4, 2, 1);
    Insert into xyz
    (SEQ_NO, ITEM_ID, ROOT_ITEM_ID)
    Values
    (8, 3, 3);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (9, 10, 3, 3);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (10, 11, 10, 3);
    Insert into xyz
    (SEQ_NO, ITEM_ID, ROOT_ITEM_ID)
    Values
    (12, 10, 10);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (13, 12, 10, 10);
    Insert into xyz
    (SEQ_NO, ITEM_ID, ROOT_ITEM_ID)
    Values
    (14, 11, 11);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (15, 13, 11, 11);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (16, 14, 11, 11);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (21, 23, 13, 11);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (104, 16, 91, 14);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (19, 16, 12, 10);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (20, 17, 16, 10);
    Insert into xyz
    (SEQ_NO, ITEM_ID, ROOT_ITEM_ID)
    Values
    (101, 110, 110);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (102, 111, 110, 110);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (103, 17, 110, 110);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (29, 31, 17, 10);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (30, 32, 17, 10);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (31, 33, 16, 10);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (35, 49, 23, 11);
    Insert into xyz
    (SEQ_NO, ITEM_ID, ROOT_ITEM_ID)
    Values
    (41, 14, 14);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (42, 91, 14, 14);
    Insert into xyz
    (SEQ_NO, ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID)
    Values
    (43, 92, 91, 14);
    COMMIT;
    Pl advise.
    Thanks,
    - Ajit
    Edited by: 952105 on Aug 10, 2012 10:44 AM

    My application tracks the product master that stores a product configuration along with its all child/sub-child records. There exists many such configurations for various parts.
    There can exist only one configuration for a given product at any point in time. But, at the same time, this product can be a part of other product configurations too (i.e. it can exist as a child in other hierarchies).
    Now, the business requirement is to pull the hierachy starting from a given product (as a root). This should also pull the hierarchy of each child/subchild existing under its hieararchy, if there exist a separate configuration for those child/subchild products.
    SET DEFINE OFF;
    CREATE TABLE XYZ
    ITEM_ID NUMBER,
    PARENT_ITEM_ID NUMBER,
    ROOT_ITEM_ID NUMBER,
    QUANTITY NUMBER,
    LINE_ID VARCHAR2(10 BYTE)
    Here, root_item_id denotes the product for which the configuration has been defined. All its child/sub-child records gets stored under this root_item_id itself. The parent_item_id column will get stored appropriately based on the immediate parent of the product under that hierarchy.
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (2, 1, 1, 5, '1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (3, 1, 1, 5, '1.2');
    Insert into XYZ
    (ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (1, 1, 1, '1.0');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (4, 2, 1, 6, '1.1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (10, 3, 3, 4, '1.1');
    Insert into XYZ
    (ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (3, 3, 4, '1.0');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (11, 10, 3, 15, '1.1.1');
    Insert into XYZ
    (ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (10, 10, 7, '1.0');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (12, 10, 10, 9, '1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (16, 12, 10, 99, '1.1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (17, 16, 10, 77, '1.1.1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (31, 17, 10, 2, '1.1.1.1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (33, 16, 10, 5, '1.1.1.2');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (32, 17, 10, 3, '1.1.1.1.2');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (14, 11, 11, 10, '1.2');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (13, 11, 11, 9, '1.1');
    Insert into XYZ
    (ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (11, 11, 8, '1.0');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (23, 13, 11, 77, '1.1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (49, 23, 11, 5, '1.1.1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (16, 91, 14, 56, '1.1.2');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (92, 91, 14, 10, '1.1.1');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (91, 14, 14, 8, '1.1');
    Insert into XYZ
    (ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (14, 14, 6, '1.0');
    Insert into XYZ
    (ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (110, 110, 1, '1.0');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (17, 110, 110, 1, '1.2');
    Insert into XYZ
    (ITEM_ID, PARENT_ITEM_ID, ROOT_ITEM_ID, QUANTITY, LINE_ID)
    Values
    (111, 110, 110, 1, '1.1');
    COMMIT;
    The expected result for product with root_item_id as 14
    item_id hierarchy_path
    11 /11
    13 /11/13
    23 /11/13/23
    49 /11/13/23/49
    14 /11/14 -- it should explode the hierarchy of product with id 14
    91 /11/14/91 as there exists a configuration for this product as a root
    16 /11/14/91/16
    92 /11/14/91/92
    In above example, it should explode the hierarachy of other products too (item_id 13,23 etc) if there exists a product configuration (starting with root_item_id as 13 or 23 etc.) for them in the table.
    Thanks,
    - Ajit

  • Need PL/SQL Command for to check all rows value for child record and update

    Hi All,
    i want to update one field following by
    one to many relationship for example
    in child applet status field is value is "Closed" for all child record then parent value also should update to closed
    Note: if one child record field status is "Open" don't do the update operation

    You can do it in single UPDATE operation.
    Here is sample & Result:
    create table PA (id varchar2(3), name varchar2(12), STATUS varchar2(12));
    insert into pa values('001','Cary','Open');
    insert into pa values('002','TOM','Open');
    create table boy (par_id varchar2(3), id varchar2(4), name varchar2(12), status varchar2(12));
    insert into boy values('001','ABC1','Cary','Open');
    insert into boy values('001','ABC2','Mac','Closed');
    insert into boy values('001','ABC3','Ray','Closed');
    insert into boy values('001','ABC4','NALLY','Open');
    insert into boy values('002','ABC5','ME','Closed');
    insert into boy values('002','ABC6','SHE','Closed');
    UPDATE PA
    SET STATUS='Closed'
    WHERE NOT EXISTS
      (SELECT 1
      FROM BOY
      WHERE BOY.PAR_ID=PA.id
      GROUP BY BOY.PAR_ID,
        BOY.STATUS
      HAVING SUM(DECODE(BOY.STATUS,'Open',1,'Closed',0,0))>0
    select * from pa;
    001     Cary     Open
    002     TOM     Closed

  • APP-PAY-07201 Cannot perform a delete when child record exists in future

    I am trying to put end date to a payment method of any employee in HR/Payroll 11.5.10.2
    but receiving the following error message:
    APP-PAY-07201 Cannot perform a delete when child record exists in future
    Can u advise what steps I should follow to resolve this issue.
    Regards /Ali

    This note is related to termination of employee while our employee is on payroll and just want to change is payment method. But in the presence of existing payment method we cannot attched another becuase we are receiving an error:
    APP-PAY-07041: Priority must be unique within an orgainzational payment method

  • Open dialog box window with checkboxes for each child record - Please Help

    Hello Everybody
    I have a 10g form with master record and 20 child records. In the child record form, currently there is a “Notes” Editor, which pops up when user click the “Edit” button. In the “Notes” editor, user enters remarks if anything is missing. For example, typical remarks will be: Statement is missing, LOC paper is missing etc.
    Now, I would like to replace “Notes” editor with a dialog box. In the dialog box , I would like to add checkboxes with values “Statement is missing” and “LOC paper is missing” etc. along with “Notes” field. The user can select checkboxes. The value of the checkboxes should go in the “Notes” field with the ability to edit it. This way, user doesn’t need to type the most common notes every time.
    I have created a “NewNotes” dialog box with checkboxes and multiline text Item. It is pops up when I click on the button. I have also created to WHEN_CHECKBOC_CHANGED trigger for each checkboxes so that the its value will go in a multiline text item.
    But, I am not sure how I can link “NewNotes” dialog box to the each record in child record block. I would really appreciate it if anybody could give me some idea.
    Thanks,

    if i understand correctly you have a note item (based on table) on every child record? when you open the dialog box: how do you put data from notes to dialog box? in the same way as you can write it back ...

  • Insert Opportunity - Product Revenue Child using WS2 - SBL-EAI-04316 error

    Hello,
    I´ve got the following error message trying to insert a product revenue child object to opportunity using WS2.
    Fehler beim Übertragen der Daten ins CRM on Demand!
    Tue Apr 26 08:06:21 CEST 2011 :: Fehler bei der Verarbeitung von Argument (Error while processing argument) urn:/crmondemand/xml/Opportunity/Data:ListOfOpportunity für Operation OpportunityInsert(SBL-EAI-04316) :: Error at thread 27334345
    Using SOAPUI the insert are successful.
    <soapenv:Body>
    <ns:OpportunityInsert_Input>
    <data:ListOfOpportunity lastpage="" recordcount="">
    <data:Opportunity operation="">
              <data:ExternalSystemId>0010110107664043232</data:ExternalSystemId>
              <data:ListOfProductRevenue lastpage="" recordcount="">
    <data:ProductRevenue operation="">
    <data:Id></data:Id>
    <data:CurrencyCode>EUR</data:CurrencyCode>
    <data:StartCloseDate>00:00:00</data:StartCloseDate>
    <data:OpportunityName>4043232</data:OpportunityName>
    <data:AccountName></data:AccountName>
    <data:stpvstums010>ÖLSERVICE ALL INKL. 5W-40</data:stpvstums010>
    <data:PurchasePrice>4960</data:PurchasePrice>
    <data:ProductName>Filter/Oel</data:ProductName>
    <data:ProductPartNumber>09XXXX</data:ProductPartNumber>
    <data:OpportunityExternalSystemId>0010110107664043232</data:OpportunityExternalSystemId>
    <data:ipvzahlums002>100</data:ipvzahlums002>
    <data:ipvzahlums001>1</data:ipvzahlums001>
              <data:ExternalSystemId>0010110107664043232001</data:ExternalSystemId>
    <data:cpvwhrums002>0</data:cpvwhrums002>
    <data:cpvwhrums003>4960</data:cpvwhrums003>
    </data:ProductRevenue>
    </data:ListOfProductRevenue>
    </data:Opportunity>
    </data:ListOfOpportunity>
    <ns:Echo></ns:Echo>
    </ns:OpportunityInsert_Input>
    </soapenv:Body>
    </soapenv:Envelope>
    Trying to insert the child via webservice 2.0 the request fails (see error message above)
    I'm running out of ideas because I'm using the same values with the webservice request.
    thx in advance
    kind regards
    Klaus

    Hello,
    I've solved the problem. It seems to be that the axis framwork has some problems to handle the complex structure of the opportunity object respectively the containing array structures (Lists). We rebuild the webservice client after deleting the unnecessary elements from the opportunity wsdl file. Doing so the webservice client works as expected. Be careful to not delete required fields which are necessary for the response message, e.g.:
    - ModifiedBy+
    - ModifiedByID+
    - ModifiedDate+
    - CreatedBy+
    - CreatedByID+
    - CreatedDate+
    - ModId+
    - Id+
    I`m sure that this cannot be the preferred way to solve the problem - but it works for me.
    regards
    Klaus

  • How to delete the child record from the database

    how to delete a parent and child record from the database can we do it in the servlet and my database is oracle

    I'm not sure I understand the question but you could certainly use the JDBC API from within your servlet to access and modify a DB. You could also use an EJB layer to access your DB and accomplish the same tasks.

  • How to create Child record at the time of master record creation.

    Hi,
    I have MasterVO and ChildVO. And association between both are 1 to *. I have a requirement like, I need to create row in ChildVO at the time of MasterVO row creation.
    I have used entity based association to create view link. This view link created ChildVO accessor in MasterRowImpl as type RowIterator.
    Actually my idea is to override create method in MasterVORowImpl and call ChildVO ViewObject and call .createRow() method on it. But I don't have access to ViewObject, instead it gave access to RowIterator.
    Could you please provide any pointer to achieve above functionality?
    Many thanks in advance.
    Jdev version - 11.1.1.7.0
    Regards,
    Dileep.

    Hi Tim,
    Now it is creating child record at the time of master row creation. But it is working only through BC tester. But when I drag the child VO instance in the jsff page, only master is get created as editable only, child is displayed as read only without populating any default values like child VO surrogate key and other default attributes. But through BC tester it is working fine.
    Am I missing anything here while implementing in UI?
    Thanks,
    Dileep.

  • Conditional Sum and look at next record

    First off, here is an example XML structure
    &lt;DATASET&gt;
    &lt;DATASET_ROW&gt;
    &lt;DEPARTMENT&gt;1&lt;/DEPARTMENT&gt;
    &lt;FEE&gt;30&lt;/FEE&gt;
    &lt;DIVISION&gt;Displayed Title&lt;/DIVISION&gt;
    &lt;/DATASET_ROW&gt;
    &lt;DATASET_ROW&gt;
    &lt;DEPARTMENT&gt;1&lt;/DEPARTMENT&gt;
    &lt;FEE&gt;20&lt;/FEE&gt;
    &lt;DIVISION&gt;Displayed Title2&lt;/DIVISION&gt;
    &lt;/DATASET_ROW&gt;
    &lt;DATASET_ROW&gt;
    &lt;DEPARTMENT&gt;1&lt;/DEPARTMENT&gt;
    &lt;FEE&gt;40&lt;/FEE&gt;
    &lt;DIVISION&gt;Displayed Title3&lt;/DIVISION&gt;
    &lt;/DATASET_ROW&gt;
    &lt;DATASET_ROW&gt;
    &lt;DEPARTMENT&gt;2&lt;/DEPARTMENT&gt;
    &lt;FEE&gt;30&lt;/FEE&gt;
    &lt;DIVISION&gt;Displayed Title 5&lt;/DIVISION&gt;
    &lt;/DATASET_ROW&gt;
    &lt;DATASET_ROW&gt;
    &lt;DEPARTMENT&gt;2&lt;/DEPARTMENT&gt;
    &lt;FEE&gt;80&lt;/FEE&gt;
    &lt;DIVISION&gt;Displayed Title 6&lt;/DIVISION&gt;
    &lt;/DATASET_ROW&gt;
    &lt;DATASET_ROW&gt;
    &lt;DEPARTMENT&gt;3&lt;/DEPARTMENT&gt;
    &lt;FEE&gt;90&lt;/FEE&gt;
    &lt;DIVISION&gt;Displayed Title 7&lt;/DIVISION&gt;
    &lt;/DATASET_ROW&gt;
    &lt;DATASET_ROW&gt;
    &lt;DEPARTMENT&gt;3&lt;/DEPARTMENT&gt;
    &lt;FEE&gt;90&lt;/FEE&gt;
    &lt;DIVISION&gt;Displayed Title 8&lt;/DIVISION&gt;
    &lt;/DATASET_ROW&gt;
    &lt;DATASET_ROW&gt;
    &lt;DEPARTMENT&gt;4&lt;/DEPARTMENT&gt;
    &lt;FEE&gt;30&lt;/FEE&gt;
    &lt;DIVISION&gt;Displayed Title 9&lt;/DIVISION&gt;
    &lt;/DATASET_ROW&gt;
    &lt;/DATASET&gt;
    Is there any way to get a sum of a field grouped by two different fields? Example in my RTF I have a repeating group based on DIVISION which inserts section breaks. Using the example I have posted here what I have in my RTF template is a sum of FEE (assume there are multiple records for DIVISION though only 1 is shown here) that displays on every page for the current group. Each DIVISION is printed on its own page. However, at the end of each DEPARTMENT, I also need to print a summary total of the sum of FEE over all records for that DEPARTMENT on the same page as the last page of the last DIVISION.
    So far, I have been able to get it to do the subtotals for each DEPARTMENT as they are within the scope of my loop. The tricky part I am unsure of how best to go about doing is getting and displaying the conditional grand total. My initial idea was to use a variable and do it manually in my template but then I relaized I did not know how to find out if the next record was the first record in the next Department or not. In this case, I am hoping to stick within the realm of using straight SQL Query as my datasource because its already done. The other option I considered was nested loops and a data template but then I realized that I wasn't too sure about manually inserting the section breaks.
    Any thoughts?

    Yes, you can do that,
    Pass me the template and XML :)
    <?if:position() = last()?>
    Last Record
    <? end if ?>
    then display the sub-total for department at the last division.
    This link , gives you idea of , how to display at the last
    http://blogs.oracle.com/xmlpublisher/2008/08/continued.html
    Use
    xdofo:inline-total display-condition="last"

  • Facing problem while deleting a child record in hibernate.

    I am trying to update a child records i have following scenario
    master record (having one to many assciation with child table cascade=all in .hbm.xml configuration file) ===> customerInfo
    detail record set (having many to one assciation with master table cascade=all in .hbm.xml configuration file) ===> customerAccountsSet
    i do following steps to update a record
    1) get the customerInfo objetc from session successfully
    2) get the customerAccountsSet = customerInfo.getCustomerAccounts();
    3) traying to add a new customerAccount say customerAccount1 to be saved for the first time without primery key in it
    4) traying to update a customerAccount say customerAccount2 to be updated with primery key in it
    5) traying to add a delete customerAccount say customerAccount3 with primery key in it
    only step 5 is not executed properly as i can still see the deleted record in db , although save and update steps have been successfully completed in db.
    can anybody tell me whats going wrong here.code for steps 2,3,4,5 is as follows in the same order
    2)Set customerAccountSet = (Set) customerInfo.getCustomerAccounts();
    3)customerAccountSet.add(customerAccount);
    4)customerAccountSet.add(customerAccount);
    5)customerAccountSet.remove(customerAccount);

    Hi Nitesh,
    1) Java stack should be up while trying to connect to R/3 backend.
    2) You can check the JCOs by doing the following:
                           Type the following url   http://<server name>:<port number>
                           Click on Webdynpro Console
                           Enter the user name and password.(You need the system admin right on the EP to do the same)
                           You can find the JCOs.
    3) Better you contact the basis guy who had created the JCOs earlier and get the JCOs tested.
    Hope it helps.
    Regards.
    Rajat
    Edited by: Rajat Jain on Oct 12, 2009 1:47 PM

  • Inserting parent /child records from a xml file ...

    XML file pasted below:
    I have loaded the xml file into a table called xml_demo which has a column xml_data of type xmltype.
    The select for parent record is as follows and it works:
    INSERT INTO balit_submissions (balitdoc, documentversion, datetime_from,job_id, status,creation_datetime)
    (SELECT 'MOL'
    ,to_number(extract(x.xml_data,'/MolDocument/DocumentVersion/@v'))
    ,to_date(substr(extract(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),
    'yyyy-mm-dd"T"hh24:mi')
    ,123456
    ,'CREATED',
    NULL
    FROM xml_DEMO x WHERE
    existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1)
    Having problem creating child records. From this file I expect to create 3 records.
    insert into balit_energy_blocks
    SO_ID,
    DATETIME_FROM,
    DIRECTION,
    BLOCK_NUMBER,
    ENERGY,
    LAST_SUBMIT_DATETIME,
    PRICE_POUNDS,
    PRICE_EUROS,
    BALIT_REF,
    STATUS,
    LAST_EDIT_DATETIME,
    MOL_REASON,
    ACQUIRING_SO_AREA)
    (SELECT 'RTE'
    ,to_date(substr(extract(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),
    'yyyy-mm-dd"T"hh24:mi')
    ,DECODE(extract(x.xml_data,'/MolDocument/MolTimeSeries/Direction/@v'),'AO1','Up','Down')
    ,to_number(substr(extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v'),19))
    ,to_number(extract(x.xml_data,'/MolDocument/MolTimeSeries/Period/Interval/EnergyPrice/@v'))
    ,sysdate
    ,null -- price pounds
    ,null -- price euro
    ,extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v')
    ,'SUBMITTED'
    ,'A96'
    ,NULL -- acquiring area
    ,sysdate
    FROM xml_DEMO x WHERE
    existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1)
    For example, there are 3 ContractIdentification tags. Example of 1:
    <ContractIdentification v="RTE_20100331_1500_16"/>
    I was expecting this select to pluck the last number from this string. In this case 16.
    The select was:
    to_number(substr(extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v'),19))
    The result I got was:
    16RTE_20100331_1500_20NG_20100331_1500_6
    All contractident values are concatnated and returns from position 19 onwards.
    Can anyone help me to extract the last number from each ContractIdentification tag value and to create the 3 records
    Thanks
    James Sathiaraj
    <?xml version="1.0" encoding="UTF-8"?>
    <MolDocument DtdVersion="3" DtdRelease="0">
    <DocumentIdentification v="MOL_20100331_1500_1600"/>
    <DocumentVersion v="1"/>
    <DocumentType v="A43"/>
    <SenderIdentification codingScheme="A01" v="17X100Z100Z0001H"/>
    <SenderRole v="A35"/>
    <ReceiverIdentification codingScheme="A01" v="10XFR-RTE------Q"/>
    <ReceiverRole v="A04"/>
    <CreationDateTime v="2010-03-31T14:10:00Z"/>
    <ValidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Domain codingScheme="A01" v="10YDOM-1001A001A"/>
    <MolTimeSeries>
    <ContractIdentification v="RTE_20100331_1500_16"/>
    <ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A02"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.45"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    <MolTimeSeries>
    <ContractIdentification v="RTE_20100331_1500_20"/>
    <ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A02"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.48"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    <MolTimeSeries>
    <ContractIdentification v="NG_20100331_1500_6"/>
    <ResourceProvider codingScheme="A01" v="10X1001A1001A515"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YGB----------A"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A01"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="17.0"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    </MolDocument>

    Hi,
    The result I got was:
    16RTE_20100331_1500_20NG_20100331_1500_6In the query you tried, you access a single record so you can't expect to get three rows "magically". The EXTRACT function just works as expected, it extracts the requested nodes, but the result is still an XML fragment (a scalar value).
    In order to achieve your goal, you have to break the MolTimeSeries sequence into relational rows.
    Two similar solutions are possible, XMLTable (10gR2 and up) or Table/XMLSequence.
    In your other post you mentioned db version 10.1, so I guess we'll go with XMLSequence :
    SELECT 'RTE'
           ,to_date(substr(extractvalue(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),'yyyy-mm-dd"T"hh24:mi')
           ,decode(extractvalue(x2.column_value,'/MolTimeSeries/Direction/@v'),'A01','Up','Down')
           ,to_number(regexp_substr(extractvalue(x2.column_value,'/MolTimeSeries/ContractIdentification/@v'),'\d+$'))
           ,to_number(extractvalue(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice/@v'))
           ,sysdate
           ,null
           ,null
           ,extractvalue(x2.column_value,'/MolTimeSeries/ContractIdentification/@v')
           ,'SUBMITTED'
           ,'A96'
           ,null
           ,sysdate
    FROM xml_demo x,
         table(
           xmlsequence(
             extract(x.xml_data, '/MolDocument/MolTimeSeries')
         ) x2
    WHERE existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1;Please also note the use of REGEXP_SUBSTR instead of the regular SUBSTR because it didn't work for "NG_20100331_1500_6".
    Hope that helps.
    Edited by: odie_63 on 24 juin 2010 21:18 - added regexp comment

  • How to update child record when item from parent record changes

    Hi, I have a master and detail form with two regions on the same page.
    Region one references parent record, one of column in the parent record is also in the child record. And is one to many relation
    between parent record and child record. How can I have the column on the child record updated when the column of the parent record is being modified?
    For exemple; Parent record has two columns : ID and Program.
    Child record has Program, goal# and status. I have two pages established, page 27 and page 28.
    Page 27 list out all programs from parent record, by clicking on edit to a program, it braches to page 28 with program listed as editable field in region one, and mulitple records list in region two from the child record with the same program.
    The problem that I am having is once the program in region one got modified using ApplyMRU, the program in child record did not get updated with the new value and therefore those record become orphan records. I need a way to update all current child records with the new program value.
    Thanks in advance for anyone who can hlep out on this problem.
    Julie
    Edited by: JulieHP on May 24, 2012 4:57 PM

    One Idea is
    If possible create a after update database trigger on the parent table to update the relevant child record.
    Next one
    Create a PL/SQL process on the parent page with process sequence next to ApplyMRU, so when the ApplyMRU is seccessfull it goes not to your process where you can have your update statement

  • How to obtain parent record from child record in relationship using API

    Hi,
    I have a record in the main table that is the child in a parent/child relationship to another main table record.  Using the Java API, how would I obtain the parent record in the relationship where I am starting with the child record?  In the API there seems to just be calls for getChildren, but not a getParent type call.
    Appreciate any immediate help that can be provided.
    Thanks,
    Eddie

    Hi Eddie,
    Please follow the below steps to retrieve only parents of a child Record.
    1. Create RetrieveRelationshipsCommand.
    2. Set the parameter RelationshipId.
    3. Set the parameter Anchor Record and Anchor Record Id. In this case the child record for which parents records to be retrieved.
    4. Set the parameter setGetChildren as false . This retrieves only the parent records for the specified child reocrd.
    5. Execute the RetrieveRelationshipsCommand.
    6. Retrieve member records from above step.
    Hope it helps
    Regards,
    Neeharika

Maybe you are looking for

  • How do i change my Itunes store account?

    How do I change my Itunes store account details or change to another country?

  • Can I open the browser in foxtabs in stead of homepage?

    When I start firefox, it opens to my homepage. In stead I want it to open "my top sites" in foxtabs, so I can choose which site I want to go to. Is this possible?

  • Help:  New PC / Lost Music

    I have a new PC. I downloaded iTunes from the Web and all my prior purchases were there once my iPod synced. Or all my tunes were there before I synced. In either case my music was there. So, I purchases 14 new songs. A couple days later when I synce

  • Redirecting based on session

    I need to redirect users based on their 'accessLevel', which is set via a session. I know how to do this in ASP but am running into problems translating into JSP. here's my code which doesn't work: <% String external = "guestPortal.jsp"; String inter

  • An error has occurred while saving your changes to the server. Network failure.

    When I'm importing my articles I get this message. "An error has occurred while saving your changes to the server. Network failure. Do you want to try again?" Any Help would be great.