Join data from various model / transpose data in models

Hello there,
is there a best practice or pattern to re-use data from a model when the original layout does not match the control's necessities right? Consider the following example:
var oData = {
  "persons": [
    {"name": "Sonja Software", "phones": ["12345", "54321"]},
    {"name": "Conrad Coder", "phones": []},
    {"name": "Mike Mailinglist", "phones": ["6789"]},
    {"name": "Hugo Hacker", "phones": ["54321"]}]};
This could be easily used to set up a table for example, see this gist here.
What is the best way to also show a table of all telephone numbers? I could manually go over the data and set up another model to achieve this:
var oDataTransposed = {
  "phones": [
    {"number": "12345", "persons": ["Sonja Software"]},
    {"number": "54321", "persons": ["Sonja Software", "Hugo Hacker"]},
    {"number": "6789", "persons": ["Mike Mailinglist"]}]};
But this would make the two models get out of sync once, e.g. a name is changed. The above mentioned gist has three files. The `exampleTransposed.js` contains a manual inversion making the phone numbers the primary items. But there is certainly a more elegant way to achieve this, isn't it? Maybe by creating a model which itself is bound to the original model by some kind of databinding or some sort of calculated properties, see this comment on knockoutjs.
M.
PS: Maybe one should also add a
{"number": undefined, "persons": ["Conrad Coder"]}
In order to not to loose some of the persons but this is just a minor detail.

Hello Martin,
in the example https://gist.github.com/ricma/cf81829181cfd4e86354 the JSONModel is used. JSONModel is a client-side model. Each of the two tables (person table, phone table) needs its own data and model. In order to synchronize models after editing a table cell, two conversion functions are needed. One function converts person data into phone data, the other converts phone data into person data (see example for implementation):
function makePhoneList(oPersonList) {
function makePersonList(oPhoneList) {
Furthermore, two callback functions are needed. These callback functions shall be called whenever a table cell is modified:
function personModelChanged(oControlEvent) {
  oPhoneData = makePhoneList(oPersonData);
  oPhoneModel.setData(oPhoneData);
oPersonTable.addColumn(new sap.ui.table.Column({
  label: new sap.ui.commons.Label({text: "Name"}),
  template: new sap.ui.commons.TextField({
    value: "{personModel>name}",
    change: personModelChanged})}));
function phoneModelChanged(oControlEvent) {
  oPersonData = makePersonList(oPhoneData);
  oPersonModel.setData(oPersonData);
oPhoneTable.addColumn(new sap.ui.table.Column({
  label: new sap.ui.commons.Label({text: "Phone Number"}),
  template: new sap.ui.commons.TextField({
    value: "{phoneModel>number}",
    change: phoneModelChanged})}));
The solution works but has some disadvantages:
data and models have to be synchronized manually
for n models, 2n-2 conversion functions are needed
every modification causes creation of at least n-1 data structures and models
Best regards,
Frank

Similar Messages

  • Display Data from multiple models in one table

    Hi Experts,
    Is it possible to display data from multiple models in one table smltnsly.
    I have created a table dynamically.Now I would like to display data from multiple models... If this possible,can anyone give me a lead as to how to do it..
    Regards
    SU

    Hi
    Your Model Nodes be
    Model1
    ---Output_Model1
    Attrib1
    Attrib2
    Model2
    ---Output_model2
    Attrib1
    Attrib2
    and the value node is
    ValueNode
    ---Attrib1
    ---Attrib2
    Now the coding.
    int size;
    IPrivate<ViewName>.IOutput_mode1Node  node1 = wdContext.nodeOuptut_Model1();
    IPrivate<ViewName>.IValueNodeElement elem;
    size = node1.size();
    for(int i=0; i<size; i++)
       elem = wdContext.createValueNodeElement();
       elem.setAttrib1( node1.getOutput_Model1ElementAt(i).getAttrib1() );
       elem.setAttrib2( node1.getOutput_Model1ElementAt(i).getAttrib2();
       wdContext.nodeValueNode().addElement( elem );
    similar code for Model Node 2
    Regards
    Abhimanyu L

  • How to get the data from the model node like a table ?

    I want to get the data from the model node  once a record ,and the node  is bound to a internal table in the RFM which I called in the R/3 system. Who can give me some advice to achive it?Thank you!!

    Hi,
    To get the data from the node:
    wdContext.node[your node name].current[node name]_InputElement().get[specific element in the node];
    or you van use:
    wdContext.current[your node]Element().get[your element in the node];
    examples:
    wdContext.nodeZ_Mepro_Po_Detail_Stock_Distri_Input().currentZ_Mepro_Po_Detail_Stock_Distri_InputElement().getUcpd_Flag();
    wdContext.currentT_Delv_ReqsElement().getShelflife();
    regards,

  • "Error occurs when loading transaction data from other model" - BW loading into BPC

    Hi Experts,
    I'm having a problem with my data loading from BW, using the standard Load InfoProvider Selections data manager package.
    If I run for a period without data it succeeds (with warning) but if there is data to be extracted I get the following error:
    Task name CONVERT:
    No 1 Round:
    Error occurs when loading transaction data from other model
    model: AIACONS. Package status: ERROR
    As it runs ok when there isn't data it appears there is something preventing the movements of data out of the cube itself, rather then a validation issue.
    Has anyone encountered similar or have any ideas as to the problem?
    Best,
    Chris

    Hi Vadim,
    It's not specific to the transformation file as I have tried with others for the same BW cube and get the same result.
    We get a warning when we try and validate the transformation file:
    "Error occurs when loading transaction data from other model".
    This only appears in the validation pop up and doesn't throw up any warnings about the transformation file itself.  The validation log says:
    Validate  and Process Transformation File Log
    Log creation time
    3/7/2014 16:09
    The result of validation of the
      conversion file
    SUCCESS
    The result of validation of the
      conversion file with the data file
    FAIL
    Validation Result
    Validation Option
    ValidateRecords = NO
    Message
    Error occurs when loading transaction data from other model
    Reject List
    I can't find any errors anywhere else.
    Best,
    Chris

  • How to join data from SAP BW and Oracle database from Webi?

    Hi,
    Need to  create a Web Intelligence Report connecting to multiple data sources.        
    Ø SAP-BW contains the data (All units).                                                                               
    Ø Oracle db contains the access security data (respective units                                                                    
    for the user).               
    Since Universe can only connect to a single data-source we have to create two universes connecting to SAP-BW and Oracle db respectively and then create a webi report to point the two universes to retrieve the equi-join data on the report.
    May I know which layer I can join the data? What kind of data I can join?
    Can I merge dimensions from both the data sources? What about measures?
    How I can create SQL query in Webi in order to simulate the join to the two data source?
    Appreciate any info related.
    thanks and regards
    nora

    Hi Nora,
    You can use Data Federator technology to federate multi-sources such as SAP BW and Oracle.
    Las you just have to create a universe on the Data Federator data source and the universe isee the data source as a single source whereas it is not.
    Then any clainet that consume uninverses can take advantage of this solution.
    Regards;
    Didier

  • Error occurs when loading transaction data from other model

    Hello Experts, I am trying to validate my transformation file and I can see peculiar behaviour of the transformation file. Even though the transformation file is not complete/  complete with all the mappings, i am getting the same error as above.
         I can see options, mapping and conversion sections are validating successfully and throwing the above error.
    Incomplete Transformation File
    *OPTIONS
    FORMAT = DELIMITED
    HEADER = YES
    DELIMITER = ,
    AMOUNTDECIMALPOINT = .
    SKIP = 0
    SKIPIF =
    VALIDATERECORDS=YES
    CREDITPOSITIVE=YES
    MAXREJECTCOUNT= 10
    ROUNDAMOUNT=
    *MAPPING
    CUSTOMER = *NEWCOL (NO_CUST)
    Validating the transformation files
    Validating options...
    Validation of options was successful.
    Validating mappings...
    Validation of mappings was successful.
    Validating conversions...
    Validation of the conversion was successful
    Creating the transformation xml file. Please wait...
    Transformation xml file has been saved successfully.
    Begin validate transformation file with data file...
    [Start test transformation file]
    Validate has successfully completed
    ValidateRecords = YES
    Error occurs when loading transaction data from other model
    Validation with data file failed
                           I am getting the same error with complete transformation file also. Please let me know where I am doing the mistake or is it a system error?
    Thanking you
    Praveen

    Hi,
    By
    *MAPPING
    CUSTOMER = *NEWCOL (NO_CUST)
    you want CUSTOMER to receive a fixed string "NO_CUST"?
    If so use,
    *MAPPING
    CUSTOMER = *STR (NO_CUST)

  • How to create ArrayColletion in mx:Script from mx:Model id="results" source="/data/data.xml" /

    How to create ArrayColletion in mx:Script from <mx:Model
    id="results" source="/data/data.xml" />
    Please see my code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Model id="results" source="/data/data.xml" />
    <mx:Script>
    import mx.collections.ArrayCollection;
    import mx.utils.ArrayUtil;
    import mx.controls.Alert;
    </mx:Script>
    <mx:ArrayCollection id ="dt1"
    source="{ArrayUtil.toArray(results.result)}"/>
    <mx:Script><![CDATA[
    [Bindable]
    public var expenses:ArrayCollection = dt1;
    [Bindable]
    public var expenses2:ArrayCollection = dt1;
    [Bindable]
    public var dp:ArrayCollection=expenses;
    public function changeDataProvider():void{
    Alert.show(expenses.toString());
    if (dp==expenses){
    dp=expenses2;
    }else{
    dp=expenses;
    ]]></mx:Script>
    <mx:Panel x="10" y="10" width="100%" height="378"
    layout="absolute">
    <mx:ColumnChart dataProvider="{dt1}" x="10" y="10"
    id="myChart" height="318" width="100%">
    <mx:horizontalAxis>
    <mx:CategoryAxis categoryField="month"/>
    </mx:horizontalAxis>
    <mx:series>
    <mx:ColumnSeries displayName="apple" yField="apple"/>
    <mx:ColumnSeries displayName="orange"
    yField="orange"/>
    <mx:ColumnSeries displayName="banana"
    yField="banana"/>
    </mx:series>
    </mx:ColumnChart>
    <mx:Legend dataProvider="{myChart}" x="481" y="10"/>
    </mx:Panel>
    <mx:Button x="284" y="416" label="Change Data" id="bt"
    click="changeDataProvider()" />
    </mx:Application>

    Tracy,
    Thanks. That worked. However I have another related question:
    I convert the xml feed to a XMLListCollection by doing:
    <mx:XMLListCollection id="mission"
    source="{xmlFeed.lastResult.day}"/>
    and
    <mx:XMLListCollection id="mission1"
    source="{xmlFeed.lastResult.day.tBlock}"/>
    On the chart I have
    <mx:ColumnChart id="missionReadiness" height="150%"
    width="100%"
    paddingLeft="2" paddingRight="2"
    showDataTips="true" dataProvider="{mission1}">
    <mx:series>
    <mx:ColumnSeries xField="" yField="@today"
    displayName="Today"/>
    <mx:ColumnSeries xField="" yField="@tomorrow"
    displayName="Tomorrow"/>
    <mx:ColumnSeries xField="" yField="@afterT"
    displayName="After Tomorrow"/>
    </mx:series>
    </mx:ColumnChart>
    the yField works, but for the xField I want to have the @date
    but refers to the parent node, so I am clueless on how to refer to
    it.
    Also, I would like to display on the chart only the values to
    a specific date (like @date="05/17/2007").
    Any suggestions on how to do that?
    Gilbert

  • Join data from 2 data sources

    Hi,
      I am trying to join data from 2 web services and present as a single table. I tried "union", "intersection"  and a few other operators but they didn't give any output. Appreciate any help in this regard.
    Thanks
    Kiran

    What version of Visual Composer are you using?

  • Importing data from a model to a custom table

    Hi,
    I'm new to Configurator.
    Can someone please advice in detail how to import all possible combinations from a model in the configurator to a custom table?
    I have created a custom table based on the items in the model.
    I have also written a CIO which displays all the possible combinations in a html page when a button is clicked.
    What i want is, how to connect to a database and import into the custom table.
    Any Help Appreciated.
    Thanks in advance.
    --PK                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    PK,
    You probably meant to post this in one of the E-Business Suite forums. This forum is for JDev ;) Try the [url http://forums.oracle.com/forums/forum.jspa?forumID=413]Configurator Forum
    John

  • Key Figures in Joined Data Source

    Hello,
    I have created some Key Figures for the Data Source "Sales Order Item". Reports based on this Data Source are working fine and also my Key Figures are displaying the right results.
    Now I want to create a Joined Data Source (Left Outer Join) with the Sales Order Item and Outbound Delivery Detail Line Items. The problem I have here is, that my own Key Figures based on Sales Order Item are not showing up in the list and I cannot select them.
    Does anyone know why? Do I have to create the same Key Figures again and again as soon as I want to join the Sales Order Item Data Source with any other Data Source?
    Thanks for any feedback.

    Key figure are not available in joining Data Sources, Characteristics of same type from different Data Source data element available in joining scenario.
    Regards
    Naveen

  • Attribute handling in Sun Java Directory Proxy Server join data views

    Hi all,
    I've configured a join data view and want to get rid of the duplicated attributes that show up in the search results since they are present in the primary and the secondary data view. The documentation says that this behaviour is configurable to return only the values of the primary data view but I can't find any information how to do it.
    Can anybody shed some light on this?
    Thanks and regards
    Geli

    Hi,
    If an attribute is present on both sides and if you want to consider the value(s) from one side only, use the viewable-attr or non-viewable-attr property at the data view level. You can specify which attribute(s) are /are not exposed by that data view (policy for read and write may differ).
    For more details, have a look at [http://docs.sun.com/app/docs/doc/819-0986/non-viewable-attr-5dpconf?l=ko&a=view|http://docs.sun.com/app/docs/doc/819-0986/non-viewable-attr-5dpconf?l=ko&a=view]

  • Joining Dates Check ..

    Hi Friends,
    I have a query related to the joining dates for an employee.The case is as follows:
    Emp.No:1 has joined on 07-May-07 and Emp.No:2 has joined on 14-May-07,but when the HR is entering the master data in SAP by mistake he enters Emp.No:2 first and system generates PERNR as 01 and for Emp.No:1 the PERNR generated is 02,which is wrong as per the joining dates.So in SAP how do we handle such cases,i.e the SAP system should gives us an error saying that Emp.No:2 has joined later than Emp.No:1.
    Suggessions required.
    Thanks & Regards,
    Krishna Prasad.

    From Business Process point of view, why it is a requirement to allot PERNR in accordance to joining dates? In a large organisation where HR processes are decentralised, it is not practically possible to enter all data in a specific time so that the system can check this condition before alloting PERNR.
    For example: Some employee are found with earlier joining dates to be entered after initial entry of Employee Data and allocation of PERNR. In that case how this logic will work even if code is changed to take care of the condition during initial entry?

  • PT functions or operations to read joining date

    Hi Time Guru,
    There is any functions or operations to read joining date whether from IT0000 or IT00041. I want to use it for comparison to further process in case the date before 15 or else do nothing.
    Your suggestion would be helpful.
    Thanks!.

    Hi,
    In Time PCR time operation HRS=YFxxxx would read date from IT0041 (check documentation in PE04 for operation HRS) and in Payroll operation NUM=F would also give you the same in payroll, but for what you need I do not think it would help, because this will give the number of days after joining date. Check the doc and you may find what you need.
    Hope it helps.
    Kind Regards,
    Edoardo

  • Create recordset join, date = todays date

    hi,
    i have been trying to create a recordset on my page which joins my clients table to insurance table which is fine.
    however i need to be able to show on my page due date = today's date.
    so in my insurance table i have a duedate column with data type DATE
    i need my recordset query to return duedate=todays date and also show if passed due date?
    can anyone help me write this query?
    many thanks

    thanks bregent, the database was helped setup viaa posts on mysql forum and by my understanding of mysql of learning over past year or so.
    i have queried using just a simple join statement.
    thanks
    Date: Mon, 22 Mar 2010 19:36:01 -0600
    From: [email protected]
    To:
    Subject: Dreamweaver Application Development create recordset join, date = todays date
    >How can i do a  query of all duedates in all tables i
    >need to query? is it seperate  recordsets?
    To query against more than one table using standard SQL you could use a UNION query. MySQL also has functionality to query against multiple tables but I don't use MySQL. But I need to ask why you are storing these due dates in more than one table? Who designed this database?
    >also  need to display the ones due the week leading up to due date?
    >so 7 days  before currendate=duedate and also once it passes that i
    >need another  recordset that displays all the ones that have passed
    >currentdate=duedate.
    This is all just simple date math. Please use the reference I gave earlier for examples or search the web for MySQL date math.
    >

  • Joining data in multiple files into a single file using BPM

    Hello All,
             Can someone kindly give me any documentation or step by step procedure to join data in multiple file and display it all in one single file, using BPM.
    Thanks in advance,
    XI_Novice

    hi,
    Check this blog also...
    /people/pooja.pandey/blog/2005/07/27/idocs-multiple-types-collection-in-bpm
    /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
    regards

Maybe you are looking for

  • Problem with packages, part duex

    Solaris 11 x86 under VBox Continuing from problem adding packages I got the mechanics of adding packages working and successfully installed the packages for x11 support.  Next I need to add some packages to install Oracle database.  Packages are list

  • Editing footage/Importing Footage

    Hi everyone, Hope you are all getting on well with snow leopard as I. I am looking for a good way to store and edit footage on my MacBook Pro (specs are below). What I have available - - Sony AVCHD XR-520VE (MPEG-2 Recording - 16Mbit/Sec) - iMovie '0

  • Transfer order Printing Error

    Hello, I have two issue with tranfer order 1) We are printing transfer order through network order CN23 .The part has been issued to network order from 3 Group WBS element .So when we are printing the Transfer order it is just printing one WBS elemen

  • Fixed length concatenation

    Hi, I am working on a scenario wherin i have to concatenate fields(around 30) on the source side and map it to a single target field.I have to map it as a fixed length i.e., if a field on the source side is of length 10 and if we pass only 5 characte

  • Things to do?

    1. First off I think you should be able to switch to full screen key board to result in less typos. 2. A way of plugging in a USB data stick into the ipod touch for videos, pictures, notes, (whatever) (although I cant see them doing this it would be