Dynamically Changing List

I am a beginner to Java.. Knows part of JDBC, AWT & Swings.. My problem is that, I am having an MS Access DB and a table contains a list some names..
I want to display all those names inside an AWT List (or something like that). When user starts entering the name into a TextField, this LIST should be updated dynamically sothat the list contains only the names which start with the letter typped in by the user.
For eg., initially, the list should contain all the names. If the user enters the letter "A", then the list should show only names that starts with "A". When he types "An", then the list should be updated to show names start with "An".
Can anyone help me in solving this problem?

This should solve your problem. Put the below code in its own file then make an FilteredJList object. You may also want to try running the main method so you can see what this class does.
The refilter() method in the FilterModel class is what sorts the data depending on what is entered into the text box. I set it to filter the objects in the list by ignoring the case, you can simply use .equals( instead of .equalsIgnoreCase( if you want it to take the case of the text into account.
import javax.swing.*;
import java.util.ArrayList;
import javax.swing.event.DocumentListener;
import javax.swing.event.DocumentEvent;
import java.awt.BorderLayout;
public class FilteredJList
    extends JList {
  private FilterField filterField;
  private int DEFAULT_FIELD_WIDTH = 20;
  public FilteredJList() {
    super();
    setModel(new FilterModel());
    filterField = new FilterField(DEFAULT_FIELD_WIDTH);
  public void setModel(ListModel m) {
    if (! (m instanceof FilterModel)) {
      throw new IllegalArgumentException();
    super.setModel(m);
  public void addItem(Object o) {
    ( (FilterModel) getModel()).addElement(o);
  public JTextField getFilterField() {
    return filterField;
  class FilterModel
      extends AbstractListModel {
    ArrayList items;
    ArrayList filterItems;
    public FilterModel() {
      super();
      items = new ArrayList();
      filterItems = new ArrayList();
    public Object getElementAt(int index) {
      if (index < filterItems.size()) {
        return filterItems.get(index);
      else {
        return null;
    public int getSize() {
      return filterItems.size();
    public void addElement(Object o) {
      items.add(o);
      refilter();
    private void refilter() {
      filterItems.clear();
      // Loop through every item in the list
      for (int i = 0; i < items.size(); i++) {
        // term is the item typed into the text field
        String term = getFilterField().getText();
        // the test string is the current item in the list
        String testString = items.get(i).toString();
        if (term.length() <= testString.length()) {
          // get the substring of the current item in the list
          // equal in length to the length of the text typed in
          testString = testString.substring(0, term.length());
          // test to see if the strings are equal, this test ignores case differences
          // to make it return false if the case matters, choose .equals() instead
          if (testString.equalsIgnoreCase(term)) {
            filterItems.add(items.get(i));
            fireContentsChanged(this, 0, getSize());
  } // End FilterModel
  class FilterField
      extends JTextField implements DocumentListener {
    public FilterField(int width) {
      super(width);
      getDocument().addDocumentListener(this);
    public void changedUpdate(DocumentEvent e) {
      ( (FilterModel) getModel()).refilter();
    public void insertUpdate(DocumentEvent e) {
      ( (FilterModel) getModel()).refilter();
    public void removeUpdate(DocumentEvent e) {
      ( (FilterModel) getModel()).refilter();
  } // End FilterField
  public static void main(String[] args) {
    String[] listItems = {
        "Chris", "Joshua", "Daniel", "Michael", "Don", "Kimi", "Kelly",
        "Keagan"};
    JFrame frame = new JFrame("FilteredJList");
    frame.getContentPane().setLayout(new BorderLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // Populate the list
    FilteredJList list = new FilteredJList();
    for (int i = 0; i < listItems.length; i++) {
      list.addItem(listItems);
// add to GUI
JScrollPane scrollPane = new JScrollPane(list,
ScrollPaneConstants.
VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.
HORIZONTAL_SCROLLBAR_NEVER);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.getContentPane().add(list.getFilterField(), BorderLayout.NORTH);
frame.pack();
frame.setVisible(true);
} // End FilteredJList
Hope it helps.

Similar Messages

  • Is it possible to have Dynamically changing list of  Radio buttons ?

    Hi,
    There is a list box which a list of values like 'State', 'City', etc.
    When the user chooses a value in the list box, based on the value chosen say 'City', I should display a list of Cities. The user should then be allowed to choose 1 and only city from the list.
    Is it possible to have list of radio buttons such that there is 1 radio button for each city and the user can then choose any one of the radio buttons ?
    In this case the number of cities and what those cities are is unknown. So I need to have a dynamically changing list of radio buttons. Is this possible ?
    Version of forms : Forms 6.0.5.
    Thanks in advance
    Aruna

    Hi Aruna
    You can create a lot of radio buttons and hide|display them in runtime. It is more suitable i think to use the t-list instead of radio.

  • Dynamically changing Restricted List

    Hi,
    We have a requirment,
    Two team IT and HR are there. Each has it's own set of Reviewers and Approvers.
    We have created a custom profile form where we have a metadata field for reviewers and approvers.
    Based on user role, i am able to set up default values of Reviewer and Approver. This is fine. But IT team has two reviewers and i need to display as them drop down list.
    Using Restricted list i can give the values, but i dont have the option to filter out reviewers based on role in restricted list.
    Can someone guide me in how to dynamically change the restricted values in UCM.
    Regards,
    Boopathy

    not sure about dynamic restricted list in rules but you can achieve your requirent in many ways...
    for description lets assume
    2 roles IT and HR
    2 metadata xApprover and xReviewer
    Option1:_
    create 2 new rules
    1) ruleIT
    - add xReviewer and xApprover fields and set the restricted list for IT team.
    - In General Tab, check the "User rule activation condition" and in custom tab use the following code
    ((userHasRole("IT"))2) ruleHR
    - add fields and define restricted list ...go to custom tab and add
    ((userHasRole("HR"))finally, add the above rules to yoru profile.
    Option2:_
    another option ...
    define idoc include as
    <@dynamichtml myCustomInclude@>
    <$if not isUploadFieldScript$>
         <$if userHasRole("HR")$>
              <select name="xApprover">
              <option value="Ap1">Ap1</option>
              </select>
              <select name="xReviewer">
              <option value="Re1">Re1</option>
              </select>
         <$elseif userHasRole("IT")$>
         <$endif$>
    <$endif$>
    <@end@>Go to your Profile Rule and Edit the fields(xApprover,xReviewer)
    ...in "Edit Rule Field xApprover" window, select "Use custom include" and enter the above include name "myCustomInclude"
    if you need any field validation, put it in else block of isUploadFieldScript
    Edited by: Bunty on Apr 3, 2013 11:32 AM

  • Dynamic Change of FieldCatalog in OO ALV Secondary List

    Dear All,
    i have Scenario like when i go to secondary list on some event, the fieldcatlog for the info is generated. then again i go back and choose some other event, now the secondary fieldcatalog list should contain few extra fields which are not being displayed. i am refreshing the fieldcatalog and filling the fieldcatalog table with new fields everytime. but the system displays only the first generated fieldcatalog.
    any ideas what can be done?
    Thanks & Regards
    Rahul

    Hello Rahul
    The following sample report <b>ZUS_SDN_TWO_ALV_GRIDS_A</b> shows how to dynamically change the fieldcatalog of the second ALV list depending on which customer has been selected (by double-clicking) on the first ALV list.
    *& Report  ZUS_SDN_TWO_ALV_GRIDS_A
    *& Screen '0100' contains no elements.
    *& ok_code -> assigned to GD_OKCODE
    *& Flow logic:
    *  PROCESS BEFORE OUTPUT.
    *    MODULE STATUS_0100.
    *  PROCESS AFTER INPUT.
    *    MODULE USER_COMMAND_0100.
    REPORT  zus_sdn_two_alv_grids_a.
    " Dynamic fieldcatalog on second ALV list
    DATA:
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      gs_layout        TYPE lvc_s_layo.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_knvv          TYPE STANDARD TABLE OF knvv.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_row              TYPE i.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_knb1      TYPE knb1.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        md_row = e_row-index.
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
    *        IS_ROW_ID    =
    *        IS_COLUMN_ID =
            is_row_no    = es_row_no.
    *   Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = '1000'.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 2
          columns           = 1
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_top
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_bottom
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Display data
      gs_layout-grid_title = 'Customers'.
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      gs_layout-grid_title = 'Customers Details (Sales Areas)'.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNVV'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knvv  " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    * Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
    *  MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    *  MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    *   User has pushed button "Display Details"
        WHEN 'DETAIL'.
          PERFORM entry_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ENTRY_SHOW_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM entry_show_details .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1,
        ls_fcat     TYPE lvc_s_fcat,
        lt_fcat     TYPE lvc_t_fcat.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  knvv INTO TABLE gt_knvv
             WHERE  kunnr  = ls_knb1-kunnr.
      CALL METHOD go_grid2->get_frontend_fieldcatalog
        IMPORTING
          et_fieldcatalog = lt_fcat.
      " Logic of fieldcatalog modification:
      " 1st customer selected -> show 1 column only
      " 2nd customer selected -> show 2 columns only
      " 3rd customer selected -> show 3 columns
      LOOP AT lt_fcat INTO ls_fcat.
        IF ( syst-tabix <= ld_row ).
          ls_fcat-no_out = ' '.
        ELSE.
          ls_fcat-no_out = 'X'.
        ENDIF.
        MODIFY lt_fcat FROM ls_fcat.
      ENDLOOP.
      go_grid2->set_frontend_fieldcatalog( lt_fcat ).
    ENDFORM.                    " ENTRY_SHOW_DETAILS
    Regards
      Uwe

  • Best Practice: Dynamically changing Item-Level permissions?

    Hi all,
    Can you share your opinion on the best practice for Dynamically changing item permissions?
    For example, given this scenario:
    Item Creator can create an initial item.
    After item creator creates, the item becomes read-only for him. Other users can create, but they can only see their own entries (Created by).
    At any point in time, other users can be given Read access (or any other access) by an Administrator to a specific item.
    The item is then given edit permission to a Reviewer and Approver. Reviewers can only edit, and Approvers can only approve.
    After the item has been reviewed, the item becomes read-only to everyone.
    I read that there is only a specific number of unique permissions for a List / Library before performance issues start to set in. Given the requirements above, it looks like item-level permission is unavoidable.
    Do you have certain ideas how best to go with this?
    Thank you!

    Hi,
    According to your post, my understanding is that you wanted to change item level permission.
    There is no out of the box way to accomplish this with SharePoint.               
    You can create a custom permission level using Visual Studio to allow users to add & view items, but not edit permission.   
    Then create a group with the custom permission level. The users in this group would have the permission of create & add permission, but they could no edit the item.
    In the CodePlex, there is a custom workflow activities, but by default it only have four permission level:
    Full Control , Design ,Contribute and Read.
    You should also customize some permission levels for your scenario. 
    What’s more, when use the SharePoint 2013 designer, you should only use the 2010 platform to create the workflow using this activities,
    https://spdactivities.codeplex.com/wikipage?title=Grant%20Permission%20on%20Item
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Dynamic Select List Allowed Values

    Howdy Folks,
    I am trying to allow end users to select their username. The usernames are generated from a rule library, and displayed in a select form element. I am doing this by having the allowedValues call the rule that generates the possible names directly. The rule returns a list of valid names. The problem I am currently having, is that if the page reloads or refreshes, then the allowedValues calls the rule again. Some of the username choices involve random numbers, so it is possible (and very likely), that separate calls to the rule will generate different potential values. So what is now happening, is that when a user selects the value, the page reloads, and the end user sees an error that looks like this:
    ( ) - Warning: Selected value for field 'Select a Valid User Name' does not match any of the allowed values.
    The reason I am reloading the page, is that I am also trying to show the user what their email address will look like with the new value. So I have a different form element that is loading is value dynamically, and referencing the select form element. This mostly works, but the warning above is unacceptable.
    Is there a way I can load the dynamically created list only once, the first time the form is viewed, and not load it again every time the page refreshes?
    Another thing I tried to do (but didn't have luck with, so I sorta gave up on it) was to use the onChange of the select to change the value of email display field. This way the page never reloads and I don't have to deal with that issue. I'm thinking the onChange might actually work, but I would need to execute javascript or something, and not just use an express <set/> command to set the value of the field name that displays the email text.
    Does anyone have advice on how to make the values only load once? Or how to change the value on the onChange event?
    Thanks!
    Jim

    Mike,
    Thanks for the feedback. I actually did try that eventually. I created a variable in the form, and initialized that variable to the list of possible values. Then I referenced the variable in the 'allowedValues' of the select form item. At that point in time I still had the select box set as an action, so it would reload the page, hoping to reload the value in the email display field. This still did not work. Each time the action fired off, the variable was re-initializing itself. I eventually tried to put in a check, so it would not re-initialize itself if it had already been initialized. That caused a syslog error.
    I ended up solving the problem using javascript. I changed the field that reported the potential email address to an html element. Then for the html attribute I made a div with an ID. I then set a line of javascript into the onChange attribute of the select form element. This worked when ever the select form value changed. I then added the same line of javascript to the onLoad attribute of the jsp pages body element. This worked for loading the page.
    This solved the problem of the page reloading and the select getting new values. That still happens if you actually reload the page, but all the form elements work without the reload now.
    Thanks!
    Jim

  • Dynamic Price List

    Hi,
    How can I create price list which dynamically changes the selling price based on the purchase price of the batch selected during Sales Order or AR Invoice?
    My requirement is that the selling price is calculated based on the purchase price of each batch instead of Last Purchase Price or Purchase Price List.
    With Regards,
    Ram.

    Hi Ram,
    Try to create a pricelist for the Purchase Price then assign the new pricelist as the base pricelist in the pricelist menu.  Hope this helps.

  • Create a dynamic file list page

    I have two folders under my main heirachy for our web site.  One is called Prod and the other is Dev.  I have folders and irpts within them.  I would like to create an html filelist page so when I am on the web testing it, I can quickly see all of my files and click anyone of them to quickly see the page.  Does anyone know how to create dynamic file list pages that will automatically update as files and folders are added?

    You can always just enable "Directory Browsing" in the default web site in IIS.
    You can do this by opening IIS and navigating the PROPERTIES of the Default Website...click the Home Directory tab...check the "Directory browsing" box...apply the settings and you should be good.
    Note: a restart of IIS might be necessary for the changes to take effect. You can do this by executing a simple "iisreset" from the run command line.

  • Dynamic Select List in Reports

    Hi,
    I have come across solutions to implement dynamic Select Lists. But can the same be implemented in a report.
    I have a report of 2 columns which are select lists. The Value of one depends of the other.
    Can this be done?
    Thanks in Advance

    Hi Abdullah,
    Thanks for the Tip. However, couple of queries.
    1) The first modification involves changing the query to : select lov_pkg.savekey() , colA, colB, ... But the function savekey takes a value.
    Ideally, I need this function to be called while loading and when the first select list is changed. How can this be done.
    2) Also, To make this change in query, I had to use (Use Generic Column Names (parse query at runtime only)) option. Now my Add Row button doesnt work? Can you tell me how that can be customized.
    Thanks,
    Sunil

  • Creating dynamic select list

    I have a dynamic select list populated by site names and URLs from a map; when a user clicks on an entry the site name and URL will fill two text boxes. There are also buttons to add, update, and delete entries. These buttons lead to actions within my JPF file.
              When I select an entry to delete, the script runs a delete SQL statement again my Ora db instance, then the page content is repopulated. I want to know how come when I do that I always get the sequence ID of the just deleted entry at the end of my select list.
              Here is a snippet of what I've got:
              JSP:
                        <netui:select
                dataSource="{actionForm.siteList[0]}"
                optionsDataSource="{actionForm.itemOptions}"
                size="4"
                tagId="siteList">
              <netui:textBox
                dataSource="{actionForm.title}"
                size="30" maxlength="200" tagId="title"/>
              <netui:textBox
                dataSource="{actionForm.url}"
                size="30" maxlength="200" tagId="url"/>
              <netui:hidden dataSource="{actionForm.key}"
                tagId="key"/>
              <script language="javascript">
                <!--
                <%=session.getAttribute("jsArray")%>
                  function siteClicked()
                    var index =
                      document[getNetuiTagName("process",this)]
                      [getNetuiTagName("siteList",this)][
                        document[getNetuiTagName("process",this)]
                        [getNetuiTagName("siteList",this)]
                        .selectedIndex]
                      .value
                    document[getNetuiTagName("process",this)]
                    [getNetuiTagName("key",this)].value
                      = index;
                    document[getNetuiTagName("process",this)]
                    [getNetuiTagName("title",this)].value
                      = siteArray[ index ][0];
                    document[getNetuiTagName("process",this)]
                    [getNetuiTagName("url",this)].value
                      = siteArray[ index ][1];
                -->
              </script>
                                  JPF:
                        Connection conn = null;
              query = "delete from stlnt_other_ref_sites " +
                      "where stlnt_ors_site_id = " + form.getKey();
              try {
                pstmt = conn.prepareStatement( query );
                pstmt.executeUpdate();
              } catch (SQLException ex) {
              try {
                Map map = new LinkedHashMap();
                while ( rs.next() )
                  map.put(new Integer(rs.getInt(1)), rs.getString(2));
                  jsArray += "siteArray[" + rs.getInt(1)
                    + "]=new Array(\"" + rs.getString(2)
                    + "\",\"" + rs.getString(3) + "\");";
                  hasResults = true;
                options = map;
                getSession().setAttribute("jsArray",jsArray);
                getSession().setAttribute("hasResults",
                  String.valueOf(hasResults));
              } catch (SQLException ex) {
              

    OK I got it working... Mostly... I don't know if it was a combination of changes that made the difference, but I'll put down what I did. First, I switched my select object in the form bean into just a string type from a string array (it was allowing the selection of one entry anyways). Second, rather than just blanking out the options map, I also blanked out the select object [eg form.setSelect("")].
              Now when I select an entry and click delete, the resulting select list is short one visible element. However, you can still select the blank spot where that last entry used to be. However, this is not a huge issue for me now; I will investigate this at a later time.

  • Default value dynamic select list

    Hi everybody,
    I have a question concerning dynamic select lists.
    I have a report of a table that shows some records. Each record has different versions of data. So when you click on a record you get to another page where you get some information about this record and where you can select the version of this information (with the help of a select list).
    The select list works fine and is defined dynamically as follows:
    select distinct a.name display_value,
    a.version_id return_value
    from cn_pl_version a,
    cn_pl_std_peplanung b
    WHERE a.version_ID = b.version_id AND
    b.pe_id = '&P6_HELP_PRODET.'
    order by a.version_id desc
    My problem is that when I click on a record I always get the report filled with the oldest version of the current record, so I always have to choose the newest version in the select list manually. I would prefer always to have the newest version in the report.
    The query for the report is as follows:
    select
    (select sum(stunden) from cn_pl_std_peplanung t02
    where abt_id = '10'
    and t02.pe_id = t1.pe_id
    and t02.version_id = t1.version_id
    and t02.idee_id = t1.idee_id) stunden_ir,
    (select name from cn_pl_version u01
    where u01.version_id = t1.version_id) Version
    from cn_pl_std_peplanung t1, cn_pl_projektelemente z1, cn_pl_version u1, cn_pl_projektidee s1
    where t1.version_id = '&P6_VERSION_WAHL.'
    and t1.pe_id = z1.pe_id
    and z1.pe_id='&P6_HELP_PRODET.'
    group by t1.pe_id, t1.version_id, t1.idee_id
    '&P6_VERSION_WAHL.' is the item of the select list
    '&P6_HELP_PRODET.' is the ID of the current record
    I'm not sure if you understood my problem, my english isn't the best...
    Thanks for any kind of help!!
    Patrick

    Hi Patrick,
    what value does you select list show, when you branch to the page? Is it the correct one?
    If not you should change your select list, that the correct version is selected as default. You can define a "default value" when you set the source of the element.
    Otherwise you can maybe set up an example application at http://apex.oracle.com.
    Best Regards
    chrissy

  • Hide Dynamic Filters list criteria

    Hello Dear Experts,
    I would like to ask you whether it is possible and how can i hide the Dynamic Filters list criteria from a BW Portal (Web) report when exporting this or broadcasting this by email in pdf format???
    I mean about the first page of the output report which includes the settings & dynamic filters & key figures used in the report.
    Great Thanks in Advance...!!!!
    Kind Regards
    George

    Hi George
    There are two options:
    1. The default template for portal display is 0ANALYSIS_PATTERN. In this, there is a web item Info field.
    This causes the static, dynamic filters to appear on the report on a click on Print button.
    The option is to copy 0ANALYSIS_PATTERN to a new web template. Change the new template for not displaying this on click of Print button using the command option. Then use the new template as default template in SPRO. This will make it applicable for all the queries run on portal directly. Remember, for changes to take affect J2EE engine should be restarted.
    2. If this is only required for few queries, then the best approach is to create the template for each report and publish them.
    However, if the look and feel should be similar to other reports, then copy 0ANALYSIS_PATTERN and make changes to print command. The default template need not be changed here.
    Thanks
    Sri

  • Vector values dynamically changing ..

    I have a function that takes in a List.This List is created by getting a auto generated ID's(sequential) from Oracle database .What I plan to do is store this list in a vector and process them later (actually trying to batch the statements).But I see that the list value is dynamically changed ...(sorry if I am a bit vaguethe example will make it more clearer)
    public static void DBInsert(List valueList) {
    loadDesc.add(valueList); // Where loadDesc is a Vector
    System.out.println("The added valeue is "+ valueList);
    System.out.println("This is the Vector"+loadDesc);
    I expect to see
    The added value is [101,NULL]
    This is the Vector [101,NULL]
    The added value is [102,NULL]
    This is the Vector [101,NULL],[102,NULL]
    The added value is [103,NULL]
    This is the Vector [101,NULL],[102,NULL],[103,NULL]
    But I get
    The added value is [101,NULL]
    This is the Vector [101,NULL]
    The added value is [102,NULL]
    This is the Vector [102,NULL],[102,NULL]
    The added value is [103,NULL]
    This is the Vector [103,NULL],[103,NULL],[103,NULL]
    What do you think I should do ...
    Thanks for your time

    What do you think I should do ...
    How about post some relevant code. If your values are not what you expect, then there is probably something wrong with how you are creating and filling your list. Post the code where you create and fill the Lists that are passed to the DBInsert method.

  • Problem of dynamically change components in Applet

    Hello, All,
    I need to dynamically change Applet components. For example, remove a button, and replace it with drop down list etc. I use remove and add methods to perform the task. But it does not work. Applet just become blank. And repaint does not help either. Any of you know how to solve the problem. I will really apprecation that.
    [email protected]

    /*    <applet code="AddAndRemove" width="400" height="300"></applet>
    *  use: >appletviewer AddAndRemove.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class AddAndRemove extends JApplet {
      ButtonListener buttonListener = new ButtonListener();
      JButton
        addButton,
        removeButton;
      JPanel centerPanel;
      JLabel statusLabel;
      GridBagConstraints gbc;
      int buttonCount = 0;
      public void init() {
        addButton = new JButton("add");
        removeButton = new JButton("remove");
        addButton.addActionListener(buttonListener);
        removeButton.addActionListener(buttonListener);
        JPanel northPanel = new JPanel();
        northPanel.add(addButton);
        northPanel.add(removeButton);
        centerPanel = new JPanel(new GridBagLayout());
        centerPanel.setBackground(Color.yellow);
        gbc = new GridBagConstraints();
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.gridwidth = gbc.REMAINDER;
        statusLabel = new JLabel(" ", JLabel.CENTER);
        Container cp = getContentPane();
        cp.setLayout(new BorderLayout());
        cp.add(northPanel, "North");
        cp.add(new JScrollPane(centerPanel), "Center");
        cp.add(statusLabel, "South");
      private class ButtonListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
          JButton button = (JButton)e.getSource();
          if(button == addButton) {
            centerPanel.add(new JButton("Button " + ++buttonCount), gbc);
            // JComponent method
            centerPanel.revalidate();
            Component[] components = centerPanel.getComponents();
            statusLabel.setText("Currently " + components.length + " buttons showing");
          if(button == removeButton) {
            Component[] components = centerPanel.getComponents();
            if(components.length == 0)
              return;
            centerPanel.remove(components[components.length - 1]);
            // container method
            centerPanel.validate();
            // comment this out to see what happens without it
            centerPanel.repaint();
            statusLabel.setText("Currently " + (components.length - 1) + " buttons showing");
      public static void main(String[] args) {
        JFrame f = new JFrame("Add And Remove Applet");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JApplet applet = new AddAndRemove();
        f.getContentPane().add(applet);
        f.setSize(400,300);
        f.setLocation(400,300);
        applet.init();
        applet.start();
        f.setVisible(true);
    }

  • Dynamic Navigation List

    Is there a way to have a dynamic Navigation List i.e. based on a SELECT statement?

    dac,
    You can make a standard report output as a HTML list fairly easily. Just follow these steps:
    1) Create a classic report based on a simple sql statement. You'll need to query what you want to display in the list, and whatever else you may need on the row (say the ID of the row so as to be able to provision a link for example). On EMP, this could be just:
    select empno, ename
      from emp2) Change some the report attributes for this report:
    - Specify a report template of 'template: xx. One Column Unordered List'.
    - Hide the empno column by unchecking 'Show' in the column attributes.
    - Other properties to suit your needs.
    3) If you wish your list item to be a link, then just edit it's link properties available in the edit column attribute page.
    Hope it helps.
    Anthony.

Maybe you are looking for

  • How to make the symbol to be resolved within the shared library ?

    I have two definitions of a symbol, one is in the main code, the other in a shared library. I want the symbol to be resolved within the shared library if it needed in the shared library. From the 'C++ User�s Guide', use the option '-Bsymbolic' to bui

  • .AVI files on a Macbook ??

    OK, so here's a thing. I used to have an iMac G5 - I used to have no problems downloading avi files via torrents, then playing them via Quicktime. Now I have an intel Macbook, and I just cannot get it to play any type of .avi file whatsoever. Ive got

  • Externalization problem in Essbase 9.2

    I've being having a rough time trying to externalize Essbase security. I've done this several times in different machines, but know I'm stuck with this error. I haven't found any useful information so far. I have reinstall Shared Services, tried drop

  • Error ERR-7621 while uploading file

    Hi , I am getting the below error while uploading files to the server from local machine by using browse option. Expecting p_company or wwv_flow_company cookie to contain security group id of application owner. Error ERR-7621 Could not determine work

  • ITunes does not automatically synch when I dock iPhone

    Ever since upgrading to OSX Lion, iTunes no longer functions like it used to.