Get the first item in the data model

I'm trying to get the first item in a data model. I expect the following to work, but it returns-1

var firstItem = myDataModel.indexOf(0)

Row is a table, and data() must return a specified row element:

if (myDataModel.size() > 0) {
  var firstItem = myDataModel.data([0])
}

indexOf search a value and returns it is row.

UPD:

In ArrayDataModel, there is also. value() function which takes a simple index.

Data() is more generic function inherited from DataModel.

So, it can be simplified to:

var firstItem = myDataModel.value(0)

Tags: BlackBerry Developers

Similar Questions

  • Need to use values from the first query in other queris to the data model

    Hello
    Here is my requirement-

    I use the data model to run multiple queries. The first query, I get 10 records. Now, I want to use these 10 records in the second query to get my final result. I am not able to use the sub query as the two motions are quite long and complex.

    Select distinct Bishop of emp

    Select empno, emp where Bishop in (: Bishop)

    I can't use: Bishop because it will give only the last value stored at Archbishop. Is it possible to be able to use all the values from the first query in the second query using the data model?

    Hello

    Are you sure that you have your "dataStructure" configured correctly? Try this simple example:

                                                                          
    

    Hope this helps

    Andy

  • How to get the date for the first Monday of each month

    Dear members,

    How to get the date for the first Monday of each month.

    I wrote the following code

    SELECT decode (to_char (trunc (sysdate + 30, 'MM'), 'DAY'), 'MONDAY', trunc (sysdate + 30, 'MM'), NEXT_DAY (trunc (sysdate + 30, 'MM'), "LUN")) FROM DUAL

    But he looks at complex bith.

    Abhishek

    Published by: 9999999 on 8 March 2013 04:30

    Use the IW format - it will make independent NLS solution. And all you need is truncated 7th day of each month using IW:

    select  sysdate current_date,
            trunc(trunc(sysdate,'mm') + 6,'iw') first_monday_the_month
      from  dual
    /
    
    CURRENT_D FIRST_MON
    --------- ---------
    08-MAR-13 04-MAR-13
    
    SQL> 
    

    Here is the list of the first Monday of the month of this year:

    with t as(
              select  add_months(date '2013-1-1',level-1) dt
                from  dual
                connect by level <= 12
             )
    select  dt first_of_the_month,
            trunc(dt + 6,'iw') first_monday_the_month
      from  t
    /
    
    FIRST_OF_ FIRST_MON
    --------- ---------
    01-JAN-13 07-JAN-13
    01-FEB-13 04-FEB-13
    01-MAR-13 04-MAR-13
    01-APR-13 01-APR-13
    01-MAY-13 06-MAY-13
    01-JUN-13 03-JUN-13
    01-JUL-13 01-JUL-13
    01-AUG-13 05-AUG-13
    01-SEP-13 02-SEP-13
    01-OCT-13 07-OCT-13
    01-NOV-13 04-NOV-13
    
    FIRST_OF_ FIRST_MON
    --------- ---------
    01-DEC-13 02-DEC-13
    
    12 rows selected.
    
    SQL> 
    

    SY.

  • How data (xml) sample in the data model get updated in bi publisher?

    Hi all

    I want to know how data sample get updates that is used in the reports to bi publisher data model?

    Thanks in advance
    Vishal

    Hello

    Its actualization based on the query that you create in the data model.

    Hope this answer will help you. Please let me know it's what you are expected?

    Thank you
    RDM

  • Is it possible to make the condition depending on the sql statements in the data models

    Hi all

    Is it possible to include the condition based on sql statements in the data models.

    For example
    if (some parameter is not null)
    <sqlstatement name="STATEMENT_1">
    ...
    </sqlstatement>
    else
    <sqlstatement name="STATEMENT_2">
    ...
    </sqlstatement>
    Is something like this? Also, the good doc is available for ' how to take full advantage of the "data models" in BI Publisher?

    Thank you
    -Sookie

    Hello Sookie,
    I couldn't find the time to get a data model of demonstration of work for you, but I'll try to explain.

    First, write a PL/SQL package. Make sure that you set all the parameters of model of data such as a global variable in the default PL/SQL package.

    CREATE OR REPLACE
    package as employee
    function BeforeReportTrigger return Boolean;
    query_text varchar (2000);
    number of p_DEPTNO;
    END;
    /

    CREATE OR REPLACE
    package as body employee
    function BeforeReportTrigger return Boolean IS
    Start

    IF (p_DEPTNO = 10) THEN
    query_text: = select col1, col2, col3 from HR.
    elsif (p_DEPTNO = 20) THEN
    query_text: = select col1, col2, col3 hr_history.
    on the other
    query_text: = select col1, col2, col3 hr_history1.
    end if;
    Returns true;
    end;
    /

    Use this package in the default package in your data model. Check the "defaultPackage ="employee"in the following data model header.

    Sample data model
    ------------------------------












    --
    --
    --
    --

    Before running the query SQL, data engine reads the "before the release of the report" and all the texte_requete argument based on the p_DeptNo value. When executing the Q1, engine sqlQuery analyze the query ' & quert_text and replace it with the actual value. For example if the p_deptno = 10, the query will be "select col1, col2, col3 from HR.

    Try it...

  • XML with a member does not properly in the data model

    I use XmlDataAccess class to load an XML list in GroupDataModel. Everything works fine if the XML file has more than one Member, however, it does not load if the list contains a single member. I use the following code to get the XML content:

    QVariant list = xda.load(home.absoluteFilePath("MembersList.xml"),"/members/member");
    

    I need to know if the list has only one or 2 + members, so I can direct the data model to load with the appropriate settings. Can I know the number of members in the list?

    This problem is closely related to this question, where a solution QML is given.

    Hi Mitch99,

    Please see this forum post for a workaround for this problem. I tested it and confirm that it works as with QML.

  • &lt; dateformat: create, get the date in en_GB, es_ES instance

    Hello

    I don't know if it's a bug or normal behavior:

    I get the date in en_GB, but I ask the date to es_ES, the snippet of code below:

    < ics:if condition =' < % = ics. GetList ("FechaBlog")! = null & & ics. GetList("FechaBlog").hasData () % > ' >

    < ics:then >

    < ics:listget listname =' < % = "FechaBlog" > "fieldname = 'value' output ="Cash out"/ >"

    < local: create varname = "currLocale" nomlocale = "es_ES" / >

    < dateformat: create name = datestyle 'PostDateFormat' = 'average' timezoneid = "Europe/Madrid" locale = "currLocale" / >

    < name dateformat:getdate = "PostDateFormat" value = "< % = ics." GetVar ("cash") % > ' valuetype = "jdbcdate' varname ="FormattedPostDate"/ >

    < / ics:then >

    < / ics:if >

    22-may-2015

    I expect to get: 22 -mayo- 2015; But if change the 'average' datestyle to "long", I am getting:


    2015 22 Mayo


    as expected, in es_ES.

    This is the normal behavior? WCS 11.1.1.8

    Kind regards

    Hello Jorgitoito,

    This is how Java has shaped the date in Spanish. It is not specific to the WebCenter Sites.

    You can give it a try with this simple Java code:

    java.util.Locale locale = new java.util.Locale("es", "ES");
     java.text.DateFormat mediumFormat   = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM, locale);
    System.out.println(mediumFormat.format(new java.util.Date()));
    java.text.DateFormat longFormat   = java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG, locale);
    System.out.println(longFormat.format(new java.util.Date()));
    

    The results I got:

    27-May-2015

    2015 27 Mayo

    I suspect that 27-May-2015 here is not in English; It is simply the first three letters of mayo.

    Kind regards

    Stephan.

  • Compare and get the data in the tables (see post for details)

    I have two tables TableA and TableB. I struggle to write a query to get the dates of TableB (instead of TableA dates) where TableA dates don't coincide with the tableB (beginning and end).

    Example 1: For account A1234,.

    TableA got 2 rows 1/31/2014-3/3/2014 (which corresponds to TableB row), but TableA got another rank 31/01/2014 - 31/01/2014 that corresponds with the date of TableB Begin. In this case, I'm looking for output as below,

    Use TableB start and end date and combine number two rows from TableA for this account

    ACCOUNTTableB_BEGINTableB_ENDAMOUNT
    A123431/01/201403/03/2014100.0000000000

    Example 2: For the B7777 account.

    TableA end date aligns with the end dates of TableB for this account, in this case I want out put as,.

    Use TableB start and end date and get the amount of TableA

    ACCOUNTTableB_BEGINTableB_ENDAMOUNT
    B777705/04/201306/05/2013200.0000000000

    Example 3: On behalf of D5555,.

    Even a TableA line corresponds with TableA, there are two other rows in TableA matching start date with TableA and correspondence with the end date with TableA, in this case, that I put as,.

    Use TableB start and end date and combine number three rows from TableA for this account.

    ACCOUNTTableB_BEGINTableB_ENDAMOUNT
    D555508/08/201410/09/20141100.0000000000

    Example 4: To account E6666.

    Table corresponds to a row with TableB and no additional lines in TableA, just display the data in A table

    Tables and data:

    create table TableA
    (
      Account varchar2(10) not null,
      Begin   date not null,
      End     date not null,
      Amount  number(19,10) not null
    )
    ;
    
    
    create table TableB
    (
      Account varchar2(10) not null,
      Begin   date not null,
      End     date not null,
      Amount  number(19,10) not null
    )
    ;
    
    
    TableA Data:
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('31-01-2014', 'dd-mm-yyyy'), 0.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('03-03-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('B7777', to_date('18-04-2013', 'dd-mm-yyyy'), to_date('06-05-2013', 'dd-mm-yyyy'), 120.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('C6666', to_date('25-06-2014', 'dd-mm-yyyy'), to_date('08-07-2014', 'dd-mm-yyyy'), 10.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('16-08-2014', 'dd-mm-yyyy'), 1000.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 0.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('D5555', to_date('16-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('E6666', to_date('01-01-2014', 'dd-mm-yyyy'), to_date('01-02-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    TableB Data:
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('03-03-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('B7777', to_date('05-04-2013', 'dd-mm-yyyy'), to_date('06-05-2013', 'dd-mm-yyyy'), 200.0000000000);
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('C6666', to_date('06-06-2014', 'dd-mm-yyyy'), to_date('08-07-2014', 'dd-mm-yyyy'), 10.0000000000);
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 1100.0000000000);
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('E6666', to_date('01-01-2014', 'dd-mm-yyyy'), to_date('01-02-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    
    
    SELECT A.ACCOUNT,
           A.BEGIN,
           A.END,
           A.AMOUNT,
           B.ACCOUNT,
           B.BEGIN,
           B.END,
           B.AMOUNT
      FROM TABLEA A
      LEFT JOIN TABLEB B
        ON A.ACCOUNT = B.ACCOUNT
    

    Hello

    SeshuGiri wrote:

    Hi Frank,.

    Your query/solution works very well, but I forgot to mention something in the first post...

    Please insert these additional lines and try the request again.

    TableA Additional lines:

    1. Insert into TABLEA (ACCOUNT, BEGIN, END, QUANTITY)
    2. values ('F9999', to_date (January 2, 2014 ',' dd-mm-yyyy ""), to_date (3 January 2014 ', 'dd-mm-yyyy'), 999.0000000000);
    3. Insert into TABLEA (ACCOUNT, BEGIN, END, QUANTITY)
    4. values ('A1234', to_date (March 3, 2014 ',' dd-mm-yyyy ""), to_date (4 March 2014 ', 'dd-mm-yyyy'), 999.0000000000);

    TableB Additional lines:

    1. Insert into TABLEb (ACCOUNT, BEGIN, END, QUANTITY)
    2. values ('A1234', to_date (March 3, 2014 ',' dd-mm-yyyy ""), to_date (4 March 2014 ', 'dd-mm-yyyy'), 999.0000000000);

    Question 1:

    The table has a rows for A1234 account (i.e. the time period different than the ranks for the same account)

    one is A1234 31/01/2014-03/03/2014, A1234 03/03/2014-03/04/2014

    Your query that returns two rows for A1234 account (which is what I want), but the amount is messed up.

    ACCOUNT BEGIN END TOTAL_AMOUNT
    1 A1234 31/01/2014 03/03/2014 1100
    2 A1234 03/03/2014 03/04/2014 1100

    Except:

    ACCOUNT BEGIN END TOTAL_AMOUNT
    1 A1234 31/01/2014 03/03/2014 101
    2 A1234 03/03/2014 03/04/2014 999

    Question 2:

    In some cases TableA will have an account (F9999), but the TableB don't. I can just this line by making the Left Join right join?

    I don't get the results with additional data. I get 1099 for two lines where account = 'A1234 '.  I get 1100 as the amount on the line with the account = "D5555.  You did it other changes to data?

    Except:

    ACCOUNT BEGIN END TOTAL_AMOUNT
    1 A1234 31/01/2014 03/03/2014 101
    2 A1234 03/03/2014 03/04/2014 999

    Still, I don't see why you want to 101 for the amount of the first row.  Why not 100?

    How can you know which rows from tablea should get attached to what rows from tableb, when the account is not unique?

    Maybe you want something like this:

    SELECT a.account

    b.begin

    b.end

    SUM (a.amount) AS total_amount

    FROM tablea a

    ON a.account = b.account JOIN tableb B

    AND a.begin BETWEEN b.begin

    AND b.end

    AND a.end BETWEEN b.begin

    AND b.end

    GROUP OF a.account, b.begin, b.end

    ORDER BY a.account

    ;

    but I guess just to your needs, and guessing is not a very good or reliable way to solve problems.

    Question 2:

    In some cases TableA will have an account (F9999), but the TableB don't. I can just this line by making the Left Join right join?

    Yes, it looks that you want an outer join.  What happened when you tried?  As always, post your code, the exact results you want from the given sample data, as well as an explanation of how you get these results from these data.

  • Get the data in table of javafx

    Bat I can get the data in table as:

    [code]

    for (int i = 0; i < dtm.getRowCount (); i ++)

    {

    for (int j = 0; j < dtm.getColumnCount (); j ++)

    dtm.getValueAt (i, j);

    [/ code]

    But how can I do this with javafx table? I google and google and google and no luck.

    In JavaFX make data are stored on a basis per line. Each line contains an element of type T (where you have a TableView), and each column specifies a value using a callback function that determines the value of the column of the value of a particular line.

    You can browse the data simply by practice

    for (T item : table.getItems()) {
      // ...
    }
    

    And then get the value of each column for each element of the given line, since you "know" what each column represents.

    For example, in the example of JavaFX documentation, you could do:

    for (Person person : table.getItems()) {
      String firstName = person.getFirstName(); // value in firstName column
      String lastName = person.getLastName(); // value in lastName column
      String email = person.getEmail(); // value in email column
    }
    

    If you want something really generic, you can try

    for (T item : table.getItems()) {
      for (TableColumn col : table.getColumns()) {
        Callback, ObservableValue> cellValueFactory = col.getCellValueFactory();
        CellDataFeatures cdf = new CellDataFeatures(table, col, item);
        Object cellValue = cellValueFactory.call(cdf).get();
        // do something with cellValue...
      }
    }
    

    If you have little chance to this need, unless you write some kind of framework. (I just typed it here, you may have get dirty you with guys a little to make things).

  • How to get the data center moref moref VM in c# using

    Hi all

    Could someone tell how to get managedobjectreference of data center using the VM moref? or any other easy way is? If anyone has examples of code in c# please share with me?

    Thank you

    Vijaya

    You can get the data center in which the virtual machine resides by the following search:

    VM Moref-> Parent (vmFolder)

    Moref folder VM-> Parent (data center)

    Parent of the virtual computer object will always be the vmFolder and the vmFolder object will always be a data center.

    For more details on the model of article inventory of vSphere, take a look at this blog post - http://www.doublecloud.org/2010/03/vsphere-inventory-structure-deep-dive/

  • How to build the data model to the server of short?

    After the Quick Start Guide, I am still confused of short components. In the view of BI, it should be a short server integrated data model and a tool to develop and manage the data model. Which component is this role, CloverETL or something?

    We have created a series of screencast "Getting started with short Information" discovered who should provide that you answer these questions.

    You can find the full outline on our page OTN: http://www.oracle.com/technetwork/middleware/endeca/learnmore/index.html

    And, the screencasts are on our YouTube channel: https://www.youtube.com/user/OracleEID

    Thank you
    Carrie

  • Code to get the data in the child table in composite SOA using the IOM APIs

    Hi all

    I am a new bie to IOM. I have a query related to obtaining data in the child table using the API of the IOM in the task of embeded java SOA composite.

    I've created a workflow that has a form of child of providing service of slef. I created a composite SOA custom also approval. In the composite approval I have embedded java code and I want to get the values entered in the child form using the API IOM inot the java code embeded in composite SOA.

    I tried gettting the child form data by using getChildAttributes(), but I'm getting the following exception.

    The local Exception stack:
    Exception [EclipseLink-7242] (Eclipse - 2.1.3.v20110304 persistence Services - r9073): org.eclipse.persistence.exceptions.ValidationException
    Description of the exception: an attempt was made to navigate a relationship using indirection that had a null Session. This often happens when an entity has a relationship of LAZY not instantiated is serialized and this lazy relationship is crossed after serialization. To avoid this problem, instantiate the LAZY relationship before serialization.
    at org.eclipse.persistence.exceptions.ValidationException.instantiatingValueholderWithNullSession(ValidationException.java:994)
    at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:218)
    at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83)
    at oracle.iam.request.vo.RequestBeneficiaryEntityAttribute.getChildAttributes(RequestBeneficiaryEntityAttribute.java:100)
    to com. CASApproval.main (CASApproval.java:137)

    Please suggest me if I'm following the correct procedure of the child form data or if we can use another approach.

    Can we get the data using formInstanceOperationsIntf.getProcessFormChildData ().

    Thanks in advance for the help.

    Thank you
    PT

    When you're in approvals, there is no form of process data. Process form data would come only when approvals are completed. If you want to read data from the child form of the DataSet (i.e. the form object as in OIM9.x) you can use the RequestService on the id of the request and read the data. Or another approach would be to the child the dataset data value in the payload of the request and read the XML payload in the composite.
    Let me know if you need more information about the second approach. As for the first approach, search through the forums here and you should find my previous posting on how to reach child dataset values using the ask service API.

    -Marie

    Found these for you:
    OIM11G: Way to get values from dataset of the application for approval
    Re: How to get the value of the AD details of payload of SOA user group

  • How to write a simple select query to get the data of the table as an XML.

    How to write a simple select query to get the data of the table as an XML. In the query, I'm just adding items below which i need be there in the XML document
    select '<test_tag>'||EMP_NAME||'</test_tag>','<date>'||sysdate||'</date>' 
    from temp_table where id_num BETWEEN 1 AND 10;
    I have need to add the root tag as well in the beginning and the end of < root > < / root > this xml file. Please advice if this is possible with the select query
    without using XMLGEN, XMLQUERY or any other packages built and function?

    I need to URL escapes with the UTF-8 code points that we have already achieved using the utl_http package. Please help how to do that without using the utl_http package.

    What is wrong with him?

    At present, the only way I can think of to avoid a call to UTL_HTTP. SET_BODY_CHARSET is to write your own little wrapper.
    In this way, you can specify the Boolean parameter or omit it if you choose to use named parameters:

    SQL> create or replace function my_url_escape (url in varchar2)
      2  return varchar2
      3  deterministic
      4  is
      5  begin
      6   return utl_url.escape(url, false, 'AL32UTF8');
      7  end;
      8  /
    
    Function created
    
    SQL> select my_url_escape('http://some.uri.com/param?lang=fr&text=contrôle') from dual;
    
    MY_URL_ESCAPE('HTTP://SOME.URI
    --------------------------------------------------------------------------------
    http://some.uri.com/param?lang=fr&text=contr%C3%B4le
     
    
  • "Deploy the data model for LCD screens" period

    Hello

    My Jboss is time-consuming while deploying the data model for LCD screens and it's initially Flash Builder 4 to display the error "Read Timed" out. How can I increase this timeout value?

    Thank you

    Houda

    Hello

    Please follow the steps below and see if it helps:

    1. in your Flash Builder click on the item in window menu, click on Preferences

    2. in the Preferences window, select Adobe-> RDS configuration

    3. Select your configured server and change/set Timeout

    I hope this helps.

  • Query to get the date from

    Hello everyone,

    How can I create a query having 2 date and 2 variable of the type:
    from 1 date 05/06/2004 
    to   2 date 15/06/2004 
    yes for 2 days
    no for  1 day
    that is, 
    
    i wish get the date with yes for 2 days and not for 1 day, this is, that I want
    
    05/06/2004 sabato
    06/06/2004 domenica
    08/06/2004 martedì
    09/06/2004 mercoledi
    11/06/2004 venerdi
    12/06/2004 sabato  
    14/06/2004 lunedi
    15/06/2004 martedi
    Thanks in advance

    Hello

    The WHERE clause controls the lines will appear.
    If your needs change, change the WHERE clause to reflect their.

    For example:

    DEFINE     from_date     = "TO_DATE ('05/06/2004', 'DD/MM/YYYY')"
    DEFINE     to_date          = "TO_DATE ('15/06/2004', 'DD/MM/YYYY')"
    DEFINE     yes_cnt          = 3
    DEFINE     no_cnt          = 2
    
    SELECT  &from_date + LEVEL - 1        AS dt
    FROM     dual
    WHERE     MOD ( LEVEL
             , &yes_cnt + &no_cnt
             )          BETWEEN  1
                       AND      &yes_cnt
    CONNECT BY  LEVEL <= 1 + &to_date
                         - &from_date
    ORDER BY  dt;
    

    This will work as long as you want the first & yes_cnt lines to display (assuming that there are many) and the following lines & no_cnt don't step to display, and then another & yes_cnt lines to display and the other & no_cnt lines not to display and so on.

    I guess & yes_cnt is a positive integer and that & no_cnt is a non-negative integer. (I.e. & no_cnt can be 0)

Maybe you are looking for