How set dynamically created query in GridControl?

How set dynamically created query in GridControl?
Thank you

If your dynamic query is based on an Entity object, then you can probably use RowSetInfo setQueryInfo method.
The argument to this method is a 'Query' object. There are three flavours provided in the oracle.dacf.dataset
package.
oracle.dacf.dataset.QueryViewInfo
defines an updateable SQL query based on a predefined BC4J View Object.
oracle.dacf.dataset.QueryStatementInfo
Creates a view object based on an arbitrary SQL statement.
oracle.dacf.dataset.QueryInfo
Creates a View Object from an Entity Object and additional SQL clauses. The View Object will have
that Entity Object as its sole Entity Object base.
If in your application you are able to specify the name of the entity, then you can use the QueryInfo method to define your
query. Please try the following.
SessionInfo si = ....
void runDynamicQuery()
RowSetInfo rsi = new RowSetInfo();
AttributeInfo ai = new AttibuteInfo(..);
ai.setName(..);
rsi..addChild(ai);
si.addChild( rsi)
rsi.setQueryInfo( new QueryInfo( ...../* include entity name */ .... ));
rsi.setName(....);
rsi.open(true);
grid.setDataItemName(...);
Hope this helps,
Sathish.

Similar Messages

  • How to dynamically create a treeview in sharepoint using javascript or jquery

    How to dynamically create a treeview in sharepoint using javascript that displays spsites ,spweb,splist

    Hi,
    In SharePoint 2010, we can customize web service and use Server Object Model to get all the SharePoint sites, webs and lists, then call the web service using jQuery and using the jQuery Treeview plugin to display the data.
    The following articles for your reference:
    Walkthrough: Creating a Custom ASP.NET Web Service
    https://msdn.microsoft.com/en-us/library/office/ms464040%28v=office.14%29.aspx?f=255&MSPPError=-2147217396
    Using Jquery to call an ASMX service in sharepoint 2010
    http://stackoverflow.com/questions/9035539/using-jquery-to-call-an-asmx-service-in-sharepoint-2010
    jQuery-ui Treeview
    https://plugins.jquery.com/btechcotree/
    Best Regards,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to dynamically create header record in a file

    Hi All,
    how can we create custom header in data file. i have interface that creates file dynamically and Generate Header is set to true. The file header contains the column names. i want to create different file header like FileName_noOfrows_currentDate .how can i do this
    example... header_15_20121213
    Thanks
    Edited by: huny on Dec 19, 2012 4:53 AM

    Hi
    Please refer to this post :
    How to Add Header and Footer in Flat file
    You should find some advices and clues to create your custom header.

  • Trying to pivot based on a dynamically created query which generates XML data

    Hi there,
    Hope someone can help
    I'm trying to pivot row data into a pivot type result set where the records for a given employee are pivoted to a single row.
    To do this, I've declared a dynamic query to retrieve the GUID values of the different training course- the actual course names are full of SQL escape characters e.g. ', (,) which I thought might mess up the dynamically generated query
    I've got as far as writing
    DECLARE
    @employeeidsVARCHAR(10)
    DECLARE
    @coursesVARCHAR(max)
    DECLARE
    @queryVARCHAR(max)
    SELECT
      @courses=STUFF((SELECT 
    DISTINCT[TRAIN_ID]
    FROM  
    [Megapay_IWA].[dbo].[HRS_TRAINING]
    FORXMLPATH('')
    ),2,0,'')+']'
    SET
    @query=
    'SELECT * FROM
    (  SELECT t.TRAIN_TRAINING,
       EMPL_EMPLOYEE_ID
            FROM 
    [Megapay_IWA].[dbo].[HRSTRNDONE] as tc
    left  join  Megapay_IWA.dbo.PAYEMPL  as e on tc.TRND_ONRID = e.EMPL_EMPLOYEE_id
    left join [Megapay_IWA].[dbo].[HRS_TRAINING] as t on tc.TRND_TRAIN_ID =t.TRAIN_ID
    ) t
    PIVOT (COUNT(EMPL_EMPLOYEE_ID) FOR TRAIN_ID in
    +@courses+'))
    AS pvt'
    EXECUTE
    (@query)
    which generates a dynamic query along the following lines but how to I update the query to correctly read the train_id values in the xml
    SELECT * FROM
    (  SELECT t.TRAIN_TRAINING,
       EMPL_EMPLOYEE_ID
            FROM 
    [Megapay_IWA].[dbo].[HRSTRNDONE] as tc
    left  join  Megapay_IWA.dbo.PAYEMPL  as e on tc.TRND_ONRID = e.EMPL_EMPLOYEE_id
    left join [Megapay_IWA].[dbo].[HRS_TRAINING] as t on tc.TRND_TRAIN_ID =t.TRAIN_ID
    ) t
    PIVOT (COUNT(EMPL_EMPLOYEE_ID) FOR TRAIN_ID in
    <TRAIN_ID>F607BA64-BD24-4C6F-810E-001E7487FB4B</TRAIN_ID><TRAIN_ID>784EF318-628F-407E-8844-0049E3DD8F86</TRAIN_ID><TRAIN_ID>C7F3B365-7E6C-4CDF-9F0C-010207D1E493</TRAIN_ID><TRAIN_ID>7A82C4C1-5A9F-4EB0-9988-018405D3347A</TRAIN_ID><TRAIN_ID>E3FC88F5-AF5F-4D75-816A-02085190FC5C</TRAIN_ID><TRAIN_ID>BEB39D10-7887-494C-ADCC-0254A1514D06</TRAIN_ID><TRAIN_ID>6D870918-CFA1-4ADA-8427-049FF01902AC</TRAIN_ID><TRAIN_ID>61D1B40A-A9B6-4835-82C4-04FDCCAF7E6D</TRAIN_ID><TRAIN_ID>CA6D6B7-5ACA-4BE0-8A08-0EE87F77F10E</TRAIN_ID><TRAIN_ID>F86E6E93-544E-43F5-A97A-10E96834C781</TRAIN_ID><TRAIN_ID>EB898326-705F-4E70-B7BB-119B8953DFA9</TRAIN_ID><TRAIN_ID>491BFC77-0FA9-42C5-A255-11C49AA28CDD</TRAIN_ID><TRAIN_ID>C7A972FB-1E73-41FC-A4EF-12F5811C9853</TRAIN_ID><TRAIN_ID>3FD2CEE3-E85F-4624-87D7-13767D2DB391</TRAIN_ID><TRAIN_ID>F8A784C0-6E56-4769-92D2-1480BCAB2BEA</TRAIN_ID><TRAIN_ID>60D36A51-E642-40A2-A2F7-14D158B59781</TRAIN_ID><TRAIN_ID>67ED29A3-E2AD-42EC-8312-156084C0BB26</TRAIN_ID><TRAIN_ID>64B637B9-CC7D-47C8-9220-15D5FA76E65F</TRAIN_ID><TRAIN_ID>59B5D61C-4228-485D-89EE-185B74E42F3C</TRAIN_ID>
    Note I'm also fine with updating the dynamic query to generate a statement that generates a normal where in constraint e.g.
    PIVOT (COUNT(EMPL_EMPLOYEE_ID) FOR TRAIN_ID in
    ('F607BA64-BD24-4C6F-810E-001E7487FB4B','784EF318-628F-407E-8844-0049E3DD8F86')
    Thanks
    John

    Thanks guys, that helped immensely,
    For the record here is the slightly modified version [made generic to show the overall principle] that got it working for me in the end
    DECLARE @ColumnList VARCHAR(MAX) = '';
    DECLARE @query VARCHAR(max);
    WITH Data AS (
            SELECT columnname
             FROM    dbo.table
             SELECT         @ColumnList +='[' +  [columnname] +'],'
             FROM         Data;
    SET @ColumnList = STUFF(@ColumnList, 2, 0, '');
    SET @ColumnList = LEFT(@ColumnList, LEN(@ColumnList) - 1)
    --print @columnlist
    SET @query=
    'SELECT otherfields, ' +@ColumnList +' FROM
    (  SELECT   otherfields,columnname, datefield
             FROM        dbo.table
    ) t
    PIVOT (max(datefield) FOR [columnname] in (' +@ColumnList + ')
    ) AS pvt'
    execute (@query)

  • How to dynamically create sqlldr control file using stored procedure

    I am trying to dynamically create the control file (.ctl) and execute the same using a stored procedure.I would be passing the file name as a parameter to this procedure. How do I go about doing this?
    The control file has the following structure. The file name (mktg) varies and is passed as an input to the stored procedure.
    SPOOL mktg.ctl
    LOAD DATA
    INFILE 'mktg.csv'
    INTO TABLE staging
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    (COMPANY_NAME,
    ADDRESS,
    CITY,
    STATE,
    ZIP)
    SPOOL OFF ;
    sqlldr scott/tiger CONTROL= mktg.ctl LOG=mktg.log BAD=mktg.bad

    We are using oracle 9i rel 2.
    I have not had much success with the creation of log and bad files using external tables when they are being used within a dynamic sql.
    Plz check this:
    Re: problems related to data loads from excel, CSV files into an oracle 9i db

  • How to dynamically create a JSF dataTable from a String[][] array

    Hi, I�m developing an application that uses columns, rows and data instead of any other attributes, so I got from a database Resultset a String[] array with the rows headers, other String[] array with the columns headers, and a String[][] array with the information between every row[] and column[] header al this String arrays depend on a method that receives the group title as a parameter so they are dynamically created, anyway I can display this information in a jsp page but I don�t know how to display this information in a JSF dataTable.
    Does anybody knows how I could do this? and which is the proper way to create a dynamically rows and columns dataTable?

    Hi, I�m developing an application that uses columns, rows and data instead of any other attributes, so I got from a database Resultset a String[] array with the rows headers, other String[] array with the columns headers, and a String[][] array with the information between every row[] and column[] header al this String arrays depend on a method that receives the group title as a parameter so they are dynamically created, anyway I can display this information in a jsp page but I don�t know how to display this information in a JSF dataTable.
    Does anybody knows how I could do this? and which is the proper way to create a dynamically rows and columns dataTable?

  • How to dynamically create sql statement for Defaulting Segment Values?

    Hi,
    Navigation:
    1) Descriptive/Segments
    2) Query for DFF to be modified
    3) Uncheck “Freeze Flexfield Definition”
    4) (B) Segments
    5) Segments Summary form opens
    6) (B) open - Segments form opens
    Now, here I want to specify Default type as "SQL Statement" and in the default value field I want to use SQL statement with parameters (to evaluate the default value).
    The parameters should be pass at runtime from the form in which we have this DFF. The parameters value should be one of the values which get evaluated at runtime in the form window.
    Please suggest how we can achieve this?
    Or is there any alternative to achieve this?
    Thanks!!
    Regards,
    Narender
    Edited by: Narender Singh on Mar 30, 2010 7:47 AM
    Edited by: Narender Singh on Mar 30, 2010 7:48 AM

    Jason,
    it is possible, though not so simple as with a report.
    What you need to do is to create a pipelined function, that returns your date and count data. This pipelined function can be the base of a pseudo-table, which can be used in a select. For the pipelined function you need to define types for one row and a table to define the return-type for your function:
    create or replace type calendar_row as object (date_time date, description varchar2(250));
    create type calendar_table as table of calendar_row;
    Then you can create the package with the function:
    ================================================
    create or replace package dyn_calendar is
    procedure set_query(i_query in varchar2);
    function view_source return calendar_table pipelined;
    end;
    create or replace package body dyn_calendar is
    v_query varchar2(100) := null;
    procedure set_query(i_query in varchar2) is
    begin
    v_query := i_query;
    end;
    function view_source return calendar_table pipelined is
    TYPE cursor IS REF CURSOR;
    c_cal cursor;
    v_date_time date := null;
    v_description varchar2(100) := null;
    r_cal calendar_row;
    begin
    open c_cal for v_query;
    fetch c_cal into v_date_time, v_description;
    loop
    exit when c_cal%notfound;
    r_cal := calendar_row(v_date_time, v_description);
    pipe row(r_cal);
    fetch c_cal into v_date_time, v_description;
    end loop;
    return;
    end;
    end;
    ================================================
    Now you can set query in a PL/SL region before the calendar:
    dyn_calendar.set_query(SELECT count(*), ' || :P8_SOURCE_DATE || ' FROM ' || :P8_SOURCE_TABLE || ' GROUP BY ' || :P8_SOURCE_DATE);
    and you can base your calendar on the query:
    select * from table(dyn_calendar(view_source))
    Good luck,
    Dik

  • How to dynamically create a table to join with

    I have a table of users and when they should submit time sheets: start date and end date.
    I have a table of timesheets with user ID and week-ending date.
    I need to construct a report of which timesheets are missing this year.
    I effectively need a table of week-ending dates for the year to join with the user and table and filter on start/end dates - and derive a list of week-ending dates for which I expect to see timesheets.
    But I donu2019t have write-access to the database: Can I effectively create a local table with the week-ending dates for the year?
    We currently solve it by using a local Excel file. Is that the most efficient way? It is also a nuisance as we have to edit the report and copy the excel file when we move directories.
    2nd question on the forum
    Mike

    Mikecro,
    Trying to actually write a SQL script of any complexity in the Command window itself is a horrible experience. I'd recommend writing your SQL in SSMS and testing it there. Once you have the script written in SSMS and it producing the desired result set you can then copy and paste it into the CR Command. (Just use hard coded dummy parameters in SSMS and replace them once they're pasted into the command.)
    If you are building "canned" reports that will ship with a software package, I'd recommend building it out as a stored procedure (and the same with any other reports). This will also make future support much easier by allowing you to make any modifications to the data set directly on the SQL Server without having to touch CR or CRS.
    If you're acting as a 3rd party consultant and you don't have the access or authority to add SP objects to the SQL Server then sticking with the Command is going to be your best bet. This is still better than using linked tables IMO.
    #1) CR simply lacks the ability to write SQL with any real level of complexity. It can't even create a simple sub-query.
    #2) It looks more professional. From an end users pov a report that uses a sql command, as opposed to linked table, demonstrates that the report developer is of a more advance skill level.
    #3) Most of your clients won't know how to write SQL themselves so they will need to re-engage your services to take care of any existing reports and to build new ones. It's easier to get repeat business than it is to get new business.
    As you've already seen, getting everything into a single, well written, SQL command can make a dramatic improvement in report performance. If you get in the habit of building all of your reports using SPs, Views or Commands, you'll quickly come to appreciate added flexibility it affords you. Once to modify your report building workflows to accommodate the change, you won't even think about going back.
    HTH,
    Jason

  • How to dynamic create Select SQL statements.

    Hi frnds,
    I want to make a SELECT statement in which all values I will get dynamically. Like i have two fields on selection screen, one for table name and one for field name. Now I need to make my ITAB according to the table selected and field name selected. So finally my ITAB will be having the field which I chosen from selection screen.
    Now how can I make a dynamic ITAB and how to create a dynamic SELECT statement?
    It wud be great if you can help me.
    Thanks
    Arpit

    Here is a sample program....
    This will get you started in programming a dynamic internal table as well as dynamic select.
    report zrich_0002.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    type-pools : abap.
    data : it_details type abap_compdescr_tab,
           wa_details type abap_compdescr.
    data : ref_descr type ref to cl_abap_structdescr.
    data: new_table type ref to data,
          new_line  type ref to data,
          wa_it_fldcat type lvc_s_fcat.
    selection-screen begin of block b1 with frame title text .
    parameters: p_table(30) type c.
    selection-screen end of block b1.
    * Get the structure of the table.
    ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
    it_details[] = ref_descr->components[].
    loop at it_details into wa_details.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = wa_details-name .
      wa_it_fldcat-datatype = wa_details-type_kind.
      wa_it_fldcat-intlen = wa_details-length.
      wa_it_fldcat-decimals = wa_details-decimals.
      append wa_it_fldcat to it_fldcat .
    endloop.
    * Create dynamic internal table and assign to FS
    call method cl_alv_table_create=>create_dynamic_table
                 exporting
                    it_fieldcatalog = it_fldcat
                 importing
                    ep_table        = new_table.
    assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
    create data new_line like line of <dyn_table>.
    assign new_line->* to <dyn_wa>.
    * Select Data from table.
    select * into corresponding fields of table <dyn_table>
               from (p_table).
    * Write out data from table.
    loop at <dyn_table> into <dyn_wa>.
      do.
        assign component  sy-index  of structure <dyn_wa> to <dyn_field>.
        if sy-subrc <> 0.
          exit.
        endif.
        if sy-index = 1.
          write:/ <dyn_field>.
        else.
          write: <dyn_field>.
        endif.
      enddo.
    endloop.
    Regards,
    Rich Heilman
    Message was edited by: Rich Heilman

  • How to dynamic create Splitter Bars

     just like  this  user interface
    Attachments:
    bar.JPG ‏178 KB

    I'm confused by the title of this question. What is it that you want to do dynamically?
    Hi Michael,
    May be I'm wrong (as you can notice my mother tongue is not English) but my interpretation of Mike's question is "What are splitter bars ?" and not "How can I dynamically add a splitter bar to a FP ?" Only Mike could confirm if this was his original question...
    Unfortunately, I don't know how to create a splitter bar programatically, and even more, I'm afraid that this is not possible. So my aim was only to answer to what seemed to be the source of Mike's confusion.
    This being said, I hope that Mike's and your confusion left !
    Message Edité par JB le 05-29-2007 02:04 PM

  • How set or create an autonumeric ID column in access.

    I want to create or set the properties of the column for set an autonumeric id, I have a vi that send data to the DB but I need this column.
    Solved!
    Go to Solution.

    Hi Abraham 
    If you have already the column that you want to be autonumeric, this snippet will help you to do it. It's select the max number on your column and then will plus one. This is a way that you can use. Each time that you need to insert new rows use this code for having an autonumeric column.
    Greetings
    Julio Mena

  • How to dynamicly create a field name AND access it

    All,
    I am trying to build a code block that will access what amounts to a table structure inside a table. I have 38 occurances if a set of 3 fields. (Source system had an internal array/occurs clause that was converted for our ODS into individual fields) I am returning a single row as a row type and have addressability to all fields. What I am trying to avoid is coding my logic block 38 times, 1 for each occurance.
    FOR X IN 1 .. 38 LOOP
    V_CAT_CD_X := 'CAT_'||X||'_CD';
    End Loop;
    The following is the display of the correctly built field:
    --> Loop Cat CD: CAT_1_CD Rec count:1 Loop counter:1
    --> Loop Cat CD: CAT_2_CD Rec count:1 Loop counter:2
    --> Loop Cat CD: CAT_3_CD Rec count:1 Loop counter:3
    --> Loop Cat CD: CAT_4_CD Rec count:1 Loop counter:4
    My problem is that my row cursor PP1 is addressable hardcoding PP1.CAT_1_CD or PP1.CAT_2_CD ect, however I am having problems using my created string to access the field.
    What do I need to do to gain accessability via this method?
    I do have the ability to select the column names from the system tables but even then, I am lacking addressability to my ROW type using the selected field name.
    Thanks
    Greg

    Not sure if this is what you are looking for:
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2  my_cur SYS_REFCURSOR;
      3  v_rec mytest%rowtype;
      4  cursor c1 is select column_name from all_tab_cols where table_name = 'MYTEST';
      5  v_sql_stmt VARCHAR2(1000) := NULL;
      6  BEGIN
      7  v_sql_stmt := 'SELECT ';
      8  FOR I IN c1 LOOP
      9  v_sql_stmt := v_sql_stmt||I.column_name||',';
    10  end loop;
    11  v_sql_stmt := RTRIM(v_sql_stmt,',');
    12  v_sql_stmt := v_sql_stmt||' FROM mytest';
    13  open my_cur for v_sql_stmt;
    14  LOOP
    15  FETCH my_cur INTO v_rec;
    16  EXIT WHEN my_cur%NOTFOUND;
    17  dbms_output.put_line(v_rec.a);
    18  END LOOP;
    19 close my_cur;
    20* end;
    SQL> /
    1
    2
    PL/SQL procedure successfully completed.
    SQL> Edited by: AP on Nov 17, 2010 5:29 AM

  • How can we create Query by using SQVI

    Hi Frendz,
    I need to generate a report by using SQVI hw can i do that, i want each step wise( I dont know how to do that even begining also), Pl send reply ASAP.
    Thanks
    Babu Rao

    Dear Babu rao
    Normally, SQVI will be used to join multiple tables.  Go to SQVI and do the following:
    1)  Give some description in "Quickview"
    2)  Click "Create" button
    3)  Give some description in "Title"
    4)  From the tab "Data Source", select "Table Join" and click blue tick
    5)  Press "Shift + F1"
    6)  Give the table you wanted and press enter
    7)  Again  Press "Shift + F1"
    8)  Again give the table you wanted and press enter
    9)  Press F3
    10) On your left screen you can see those two tables with header "List fields"  and  "Selection Field"
    11)  Whatever data you want to give as input, (say for example based on sales organisation, you want some report), select the white box under selection field
    12)  Whatever data you want as report format, select those fields under List fields
    13)  Execute the report
    thanks
    G. Lakshmipathi

  • How to dynamically create a movieclip of an image

    Hi there !
    Im Java developer in transition to AS3, my task is to create one of those spaceship games ( beathazard / asteroids style ) but im already being destroyed by the differences between these languages.... im trying to make this game completely through AS3, in other words, trying to evade manual setup as much as possible, at this moment, im trying to create my spaceship (an instance of my SpaceShip class), my background (instance of my Scenary class), my bullets (instance of Bullet class) and my game ( Game class ).
    The first problem im having is that i cant seem to make the ship find its sprite while executing its  constructor so i can create a new instance of it and add it to my game (actually, my scenary).
    Any ideias of how to do this ?Im using this constructor :
    public function Nave() {
    var imgLoader : Loader = new Loader();
                   imgLoader.load(
    new URLRequest("../img/normalShip.png"));
    this.addChild(imgLoader);}
    and then just creating an instance of this ship on my game and adding it as a child of my game.
    Thanks in advance ! Any advice will be very welcome !!!

    If you want to add the loaded image to a MovieClip or Sprite, you need to wait until the image is loaded before doing so.  To wait for it you assign a COMPLETE event listener to the contentLoaderInfo property of the Loader.  Once it is loaded you can have the event handloer function process the Loader.content (the image) into whatever object you plan to have it in.

  • How to dynamically create selecItems in a pgae from a table

    To those who may be able to help:
    I am using JDeveloper 10.1.3.4. In my application, I need to put a number of selectItem tags such as radio buttons on a page. What is difficult about this is that it can not be known in advance how many radio buttons there will be, because is depends on how many rows will be selected from a table, even though it is known that the number of selected rows will not exceed 3. I am considering using the radio button because it looks better on the page, and the user must select only one.
    A few sample rows from the table:
    TERM    AVAILABLE  SWITCHED
    200809  N          OFF
    200902  N          ON
    200906  Y          ON
    200909  Y          ONThe SQL of the view object from this table/(entity object) is:
    SELECT Terms.TERM
    FROM TERMS Terms
    WHERE AVAILABLE = 'Y' AND SWITCHED = 'ON'I am able to drag the selected two rows from the data control palette. But it is just a table. What I need is to ask the user to select one of them. What is the easiest way to achieve that?
    Many thanks for your help!
    Newman

    Hi, Sireesha,
    I almost succeed in the backing bean, except one last line when adding the new SelectItem into the list. Here is the code:
        private List<SelectItem> termList;
        public void setTermList(List<SelectItem> termList) {
            this.termList = termList;
        public List<SelectItem> getTermList() {
            return termList;
            FacesContext fc = FacesContext.getCurrentInstance();
            ValueBinding vb =    fc.getApplication().createValueBinding("#{data}");
            BindingContext bc = (BindingContext)vb.getValue(fc);
            DCDataControl dc = bc.findDataControl("ZBOVModuleDataControl");
            ApplicationModule am = (ApplicationModule)dc.getDataProvider();
            ZBOVModuleImpl zbovam = (ZBOVModuleImpl)am;
            TermsForStudentsImpl termsOpen = (TermsForStudentsImpl)zbovam.getTermsForStudents1();
            System.out.println("Number of rows: " + termsOpen.getEstimatedRowCount());
            long size = termsOpen.getEstimatedRowCount();
            for (int i = 0; i < size; i++) {
                Row currRow = termsOpen.getRowAtRangeIndex(i);
                String term = (String)currRow.getAttribute("Term");
                String termDesc = translateTerm(term);
                SelectItem selectItem = null;
                selectItem = new SelectItem(term, termDesc);
                // The code runs fine except when the one line below is uncommented
                //termList.add(selectItem);
                System.out.println(term + ": " + termDesc);
        public String translateTerm(String yyyymm) {
            String year = yyyymm.substring(0,4);
            String semester = null;
            String month = yyyymm.substring(4,6);
            if (month.equals("02")){
                semester = "Spring";
            } else if (month.equals("06")) {
                semester = "Summer";
            } else if (month.equals("09")) {
                semester = "Fall";
            return semester + " " + year;
        }The page in the front is blank except one line of static text, and nothing in the page binds to the termList in the backing bean yet. When the line {color:red}termList.add(selectItem);{color} is commented out, the page runs and the console prints out:
    09/08/17 03:17:25 Number of rows: 3
    09/08/17 03:17:25 200809: Fall 2008
    09/08/17 03:17:25 200902: Spring 2009
    09/08/17 03:17:25 200906: Summer 2009But uncommenting that line will cause a NullPointer error, and the error message says that the SelectTerm class can not be instantiated (I wrap round the long line of error message in the browser into several shorter lines):
    javax.servlet.jsp.JspException: javax.faces.FacesException:
       javax.faces.FacesException: Can't instantiate class: 'zbov.viewcontroller.backing.student.SelectTerm'..
       class zbov.viewcontroller.backing.student.SelectTerm : java.lang.NullPointerExceptionI am stuck here. Do you have any idea what is wrong and how to get around this?
    Thank you for helping.
    Newman

Maybe you are looking for