Need to add row and set attribute value on pageload

Guys,
On my page based on the pageflowscope variable value, i need to add a row for master and one row for detail viewobject and set attribute values. (Some of the attribute are LOV and Checkboxes as well)
I am using following code to create records.....records are being added but i am not able to set the attributes
OperationBinding ob;
ob = ADFUtil.findOperationBinding("Create");
ob.execute();
ob = ADFUtil.findOperationBinding("CreateInsert3");
ob.execute();
I am using following code to set the attributes value
DCIteratorBinding dc1 = ADFUtil.getBindingIterator("firstiterator");
DCIteratorBinding dc = ADFUtil.getBindingIterator("seconditerator");
row1=dc1.getCurrentRow();
row=dc.getCurrentRow();
row.setAttribute("activest","A");
row1.setAttribute("type","dc14");
Anything i am doing wrong here or any suggestion to try is greatly appreciated....

Vinod,
Yes commit button is there and yes its also has entry in pagedef...
When I open the same page on edit mode and i can edit regular record and save them
Problem is that when i open the page on new mode and try to add rows on page load..... and setting values as described above.... save button somehow doesn't work...
seems like after i add the rows on the fly, i need to refresh the binding?
any help is greatly appreciated....
thank you guys

Similar Messages

  • Is it possible to get and Set attribute value in OVD through JNDI or Java

    Hi,
    I have a requirement to read an OVD Attribute value from a Jsp Page and set the Attribute value in OVD.
    Is it possible to achieve it through JAVA/JNDI code, Any pointers or code snipplet are welcome.
    Thanks
    Ak

    Use JNDI with LDAP provider or another LDAP java library, plenty of examples on google

  • Overriding the method EntityImpl.create() and setting attribute values?

    Hello,
    I need to set a date to '01/01/2001' if field dateto is left blank when user is inserting a new record.
    How to you do that please ?

    The easiest way would be to set the date as default in the EO. The date then is visible when you create a new row. If the use overwrites it you get the new date, if he leafs hte date untouched you get the default date.
    Timo

  • 11.1.1.6 - NPE :: Failed to apply row key set attribute change in logs

    Hi All ,
    Using  POJO Data controls and ADF Faces - Jdev 11.1.1.6.
    Setup - Tab -> taskflow ->jsff -> table
    Issue happens once I reload the taskflow . I get the below error's in the logs (only if data is populated in the table in jsff via search).
    There is no pointer to my code , this happens immediately after the iterator is refreshed in the page definition.
    Please let me know if you need any other information.
    There are various unresolved threads on this like - https://forums.oracle.com/message/10747913#10747913
    <RowKeySetAttributeChange$GetOldValueAndUpdate> <_updateKeySet> Failed to apply row key set attribute change. Reason : {1}
    java.lang.NullPointerException
      at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.<init>(JUCtrlHierNodeBinding.java:210)
      at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierNodeBinding.<init>(FacesCtrlHierNodeBinding.java:66)
      at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding.createNodeBinding(FacesCtrlHierBinding.java:94)
      at oracle.jbo.uicli.binding.JUCtrlHierBinding.createRootBinding(JUCtrlHierBinding.java:409)
      at oracle.jbo.uicli.binding.JUCtrlHierBinding.getRootNodeBinding(JUCtrlHierBinding.java:105)
      at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$HierCurrencyRowKeySet.getRowIterator(FacesCtrlHierBinding.java:1178)
      at oracle.adfinternal.view.faces.model.binding.CurrencyRowKeySet._computeCurrentRowKey(CurrencyRowKeySet.java:125)
      at oracle.adfinternal.view.faces.model.binding.CurrencyRowKeySet.iterator(CurrencyRowKeySet.java:41)
      at java.util.AbstractCollection.addAll(AbstractCollection.java:303)
      at org.apache.myfaces.trinidad.change.RowKeySetAttributeChange$GetOldValueAndUpdate._updateKeySet(RowKeySetAttributeChange.java:136)
      at org.apache.myfaces.trinidad.change.RowKeySetAttributeChange$GetOldValueAndUpdate.invokeContextCallback(RowKeySetAttributeChange.java:117)
      at org.apache.myfaces.trinidad.component.UIXCollection.invokeOnComponent(UIXCollection.java:1063)
    Message was edited by: SudiptoDesmukh

    Figured out that the issue is due to selectedRowKeys property and happens whenever the taskflow is refreshed and the iterator binding is executed. Again happens only when prior to region refresh few rows have been selected (other than first selected by default).
    Issue is I cannot remove selectedRowKeys as I need to show the first row of the table as selected.
    Will probably need to log an SR as this is happening throughout the application and looks to be a fwk issue.

  • Matrix Add Row and Duplicate Row

    Hi All,
    Can anybody suggest me how to work on Add row and duplicate row in any document table.
    Lets take one example
    Sales order document
    In this doc we have table format where we specify item no, item description etc. In this table when we right click on particluar row we have option for add, delete, duplicate rows..etc.
    wht i would like to know is that when we click add row .....one row is added and number is incremented under # column.  Hw to perform and display this auto increment/ decrement of number for these rows under this # column
    thanks
    harish

    Hi,
    I tried following both code, but in that i am geting value. Means i am getting .Value  Why i not getting value.
      matrix.Columns.Item("V_-1").Cells.Item(pVal.Row).Specific.value = matrix.RowCount
    and i also tried for "AddRow",
    If pVal.BeforeAction = False Then
                    Select Case pVal.ItemUID
                        Case "AddRow"
                            matrix = form.Items.Item("mtr").Specific
                            If matrix.RowCount > 0 Then
                                If Trim(matrix.Columns.Item("V_-1").Cells.Item(matrix.RowCount).Specific.value) = "" Then
                                End If
                            End If
                    End Select
                End If
    In both example i not getting .Value.
    Plz tell y ?
    Thanks

  • How to stop "Add Row" and "Delete" from committing.

    Hello, I am new to Application Express, and maybe someone can help me make this save like an Oracle Form.
    If you hit the "Add Row" button, enter data, then hit the "Add Row" button again, it commits the first row. If you check a value and hit the "Delete" button, it commits the delete. I would like the insertions and deletes to be handled like an update, that is with an explicit commit by hitting the "Apply Changes" button.
    Can I control this in Application Express, and how?
    Thank you,

    Kevin,
    1. instead of having a form on a table, you would create a form on a collection,
    2. collection is also a table but it is only of a temporary nature - it is valid with the corresponding session. Once the session is closed, you can't access the collection.
    3. to see how to create a collection and a tabular form use this example:
    http://htmldb.oracle.com/pls/otn/f?p=31517:176
    4. add row and delete will add / delete a copy of your table data. You can then create a process to save the data in your target table only if the button apply changes is clicked.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Looping and setting cfset values (from a query)

    Stuck on how to get this to work.
    How would I go about looping and setting these values instead
    of doing them individually?
    The query this <cfset> references works fine and will
    work but repeats...
    <cfset ans1 = (qryGetPcts1.q1Ct / qryGetCounts.qID2) *
    100>
    <cfset ans2 = (qryGetPcts2.q2Ct / qryGetCounts.qID2) *
    100>
    <cfset ans3 = (qryGetPcts3.q3Ct / qryGetCounts.qID2) *
    100>
    <cfset ans4 = (qryGetPcts4.q4Ct / qryGetCounts.qID2) *
    100>
    <cfset ans5 = (qryGetPcts5.q5Ct / qryGetCounts.qID2) *
    100>
    So I'd like to loop and set them all instead...
    <cfloop index="i" from="1" to="27">
    <cfset ans#i# = (qryGetPcts#i#.q#i#Ct /
    qryGetCounts.qID2) * 100>
    </cfloop>
    But it's responding with this...
    Invalid CFML construct found on line 196 at column 19.
    ColdFusion was looking at the following text:
    I'm sure I'm missing something simple b/c this must be
    possible? Can I use a cfset in a loop?
    Help is appreciated

    In the main everything is in CF is in a struct. Armed with
    this information you use array notation to help you.
    <cfloop index="iCount" from="1" to="27">
    <cfset variables["ans" & iCount] =
    (variables["qryGetPcts" & iCount]["q" & iCount & "Ct"]
    / qryGetCounts.qID2) * 100>
    </cfloop>

  • Dynamic Table - Add rows and columns in same table

    Hi there,
    I wonder if someone could help please? I'm trying to create and table where a user can add both rows and columns (preferably with separate buttons) but am having trouble trying to figure out how to do this. Is it possible? If so how? I'm not familar with script but have found examples of seprate tables where you can add a row and then another table where you can add columns and essentailly want to merge the two but cannot make it work.
    Any help much appreciated!
    Thanks,
    Ken

    It is great example....you can learn the concepts there and apply....however you may have to think twice before you implement column adding dynamically....because the technique here is make copy of what we already have and reproduce it as a new item and this technique works great for rows as they all have every thing in common. But when it comes to columns it may have unique visible identity as column head and displaying repeatedly the same column head may not look good. Of-Course you can do few extra lines of code and change the column appearance based on users input each time. Situations where users need to add additional column is very unlikely (sure your requirement might be an exception).
    Key in allowing adding/removing instances is managing design mode settings under Object>>Binding>>....and select the checkbox "Repeat <subform/row/...> for Each Data Item" and then set Min, Max and Initial count values.
    Also you need to club your effots by using simple scipt with button clicks....
    for the example refered in URL you posted following is what I did to make the first table allow Adding/Removing Rows....
    1. Opened the form in LC designer.
    2. Add two buttons AddRow & RemoveRow right next to RemoveColumn
    3. For AddRow I used following JS code....
          Table1._Row1.addInstance(1);//that means any time this button is clicked a new instance of Row1 is added use _Row2 or Row3 based on your needs
          var fVersion = new Number(xfa.host.version); // this will be a floating point number like "7.05"
          if (fVersion < 8.0) // do this for Acrobat versions earlier than 8.0
           // make sure that the new instance is properly rendered
           xfa.layout.relayout();
    4.  For RemoveRow I used following JS code....
         Table1._Row1.removeInstance(1);//Syntax is...<objectReference>.removeInstance(<index of the repeating object that needs to be removed>); //in this case since we used 1 alwasys second object from top gets deleted.
          var fVersion = new Number(xfa.host.version); // this will be a floating point number like "7.05"
          if (fVersion < 8.0) // do this for Acrobat versions earlier than 8.0
           // make sure that the new instance is properly rendered
           xfa.layout.relayout();
    5. Now time to update settings at Object>>Binding tab and set "Repeat......" and also set Min, Max and Initial count as explained above.
         Those settings needs to be updated for Row1 (or your choice of row) of the table
    6. Set the Height to Expand of the Subform, where the table is housed....  this is done under Layout pallet
    7. Save the PDF as dynamic template and verify the results...
    If you still run into issues I can send you copy that works on my machine, but you need send me an email at n_varma(AT)lycos.com
    Good luck,

  • Need to add Header  and footer in an alv grid display output.

    How can I add header and footer in an alv grid dispay output.
    For the grid display, I am using the function module "REUSE_ALV_GRID_DISPLAY".

    HI,
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                i_callback_html_end_of_list = 'END_OF_LIST_HTML'
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
      DATA: ls_text TYPE sdydo_text_element,
            l_grid     TYPE REF TO cl_gui_alv_grid,
            f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
      ls_text = 'Footer title'.
    adds and icon (red triangle)
      CALL METHOD end->add_icon
        EXPORTING
          sap_icon = 'IL'.
    adds test (via variable)
      CALL METHOD end->add_text
        EXPORTING
          text         = ls_text
          sap_emphasis = 'strong'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(bold)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Bold text'
          sap_emphasis = 'strong'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(normal)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Nor'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(bold)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Yellow '
          sap_emphasis = 'str'.
    adds and icon (yellow triangle)
      CALL METHOD end->add_icon
        EXPORTING
          sap_icon = 'IC''.
    display text(normal)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Mor'.
    *set height of this section
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = l_grid.
      CALL METHOD l_grid->parent->parent->(f)
        EXPORTING
          id     = 3
          height = 14.
    ENDFORM. "end_of_list_html.
    This will solve  it. Post if you need more help in this.
    Regards,
    Madhu.

  • Parsing XML data stored as CLOB in DB and save attribute values in table

    Hello,
    I have a CLOB column in table that is holding XML data as follows,
    <banners>
    <banner-image id="0">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>www</click-through-url>
    <make>Acura</make>
    </banner-image>
    <banner-image id="1">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>gfrty</click-through-url>
    <make>BMW</make>
    </banner-image>
    </banners>
    Now I need to parse thru the above XML data and pull the attribute values to store in another table as follows,
    BANNER_IMAGE_ID | TYPE | LOCAL_PATH | CLICK_URL | MAKE
    0 | BANNER | http.gif | www | Acura
    1 | BANNER | http.gif | gfrty | BMW
    And XML data doesn't always end up with 2 rows in this table....some times it may be 3 or 4 as well. It is just that in this example it ended up with 2 rows.
    So, I would appreciate if someone can help me find a generic way of doing this,
    Thank you in advance,
    Madhu.

    This is not a reply.. sorry.
    I took have a similar problem only..
    can you pls help me
    XML structure.
    <PODetails>
    <POHeader>
    <CurrencyID>INR</CurrencyID>
    <ExchangeRate>1</ExchangeRate>
    <RefNo>0080000110</RefNo>
    <VendorID>1200</VendorID>
    <TransDate>2006-12-20</TransDate>
    <DocRelationshipId>PURCHASE</DocRelationshipId>
    <LocationID>0000102327</LocationID>
    </POHeader>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>L HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>3.000</Quantity>
    <PriceValue>2509.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>M HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>2.000</Quantity>
    <PriceValue>1673</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1556</ItemID>
    <Size>39FS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>1.000</Quantity>
    <PriceValue>836.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    </PODetails>
    The DB is ORACLE 9i
    This is stored in a XML table of type XMLTYPE.
    THIS I USED THE .extract function to get the values of the nodes.
    POHeader details are working fine. But when i get the POItemDetails i am getting 'ARSH1332ARSH1332ARSH1556' when i issue the command
    select a.extract('/PODetails/POItemDetails/ItemID/text()').getStringVal() ItemID
    FROM xmltable a
    WHERE a.existsnode('//POItemDetails/ItemID')=1
    Pls Help..
    Regds,
    Santhoshkumar.G.

  • Pass variable and set default value based on user's group

    Hello
    I'm using SharePoint 2010 and SQL 2012. I need to send a variable to the page and based on its value, set default value for a drop down list and send it to other web part to filter the data. Is it possible for certain users to send that value as a default
    and limit user to see only this value in the text field or drop down list; for others - to allow to see the drop down list, but also set the default value for that list?
    The main page was designed in SharePoint designer, using web parts (aspx page). I had setup a connection to Active Directory and already have the code to get user's groups and based on their group, I have that variable pulled into the web page for further
    use. But I don't know how to pass that value as a default value to the web part (currently using SharePoint Filter web part). When I tried to set a default value for the web part - it automatically puts the quotation marks around the name of the variable
    and shows it as a text instead of showing the value of the field.
    Thank you!
    P.s. I have limited knowledge of SharePoint and need guidance (links, examples, recommendations)!
    Alla Sanders

    Thank you for your response. I'll try to give you more details. On PageA I check user's groups and based on the group, assign the value and pass it to the next page (no input from the user, all done behind the scene and user is redirected to PageB).
    On the next page I read that value and would like to send it to the SharePoint List Filter Web as a default value, as well as send it to another web part that displays the list from SQL, filtered using that default value. Ideally, if the user is from Group
    A, I'd like for them to have only one value in that drop down list; if user is from Group B - give him drop down list with 40 items to choose from. Below there is a part of the code and variable fnum has the value from PageA (if I print the value on the screen
    - I do see that it has correct value, so the code that gets groups from Active directory works correctly). If I assign fnum as a default value of the list, it shows "fnum" instead of the value of variable fnum. I connect to SQL database, using external
    content - so the other list that I'm filtering based on the value in that drop down list - is XSLT Data View Web part. I also have 2 more filters on that page, that user will have full access to and based on their input, it is also sent to the XSLT web part
    to filter out more data. Since one of the filters is the date and I am filtering data starting from the date that user chooses - XSLT is the only web part that I was able to make it work with.
    I looked at the link you provided (thank you). It is using Content Query Web part. Will it work with external content, as well as accepting multiple filtering, including custom starting date? I appreciate your help!
    <%
    string fnum = Request.QueryString["field1"];
    %><table cellpadding="4" cellspacing="0" border="0" style="height: 1000px">
    <tr>
    <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" colspan="2" valign="top" style="height: 101px">
    <WebPartPages:WebPartZone runat="server" Title="loc:Header" ID="Header" FrameType="TitleBarOnly"><ZoneTemplate>
    <WpNs0:SpListFilterWebPart runat="server" FilterMainControlWidthPixels="0" RequireSelection="False" ExportMode="All" PartImageLarge="/_layouts/images/wp_Filter.gif" AllowHide="False" ShowEmptyValue="True" MissingAssembly="Cannot import this Web Part." AllowClose="False" ID="g_1ccc4bca_3ba1_480b_b726_adfdb1e9e02d" IsIncludedFilter="" DetailLink="" AllowRemove="False" HelpMode="Modeless" AllowEdit="True" ValueFieldGuid="fa564e0f-0c70-4ab9-b863-0177e6ddd247" IsIncluded="True" Description="Filter the contents of web parts by using a list of values from a Office SharePoint Server list." FrameState="Normal" Dir="Default" AllowZoneChange="True" AllowMinimize="False" DefaultValue="fnum" Title="Facilities List Filter" PartOrder="2" ViewGuid="2da5d8db-6b55-4403-80a8-111e42049f8b" FrameType="None" CatalogIconImageUrl="/_layouts/images/wp_Filter.gif" FilterName="Facilities List Filter" HelpLink="" PartImageSmall="/_layouts/images/wp_Filter.gif" AllowConnect="True" DescriptionFieldGuid="2d97730a-cd0d-4cb9-8b55-424951201081" ConnectionID="00000000-0000-0000-0000-000000000000" ExportControlledProperties="True" TitleIconImageUrl="/_layouts/images/wp_Filter.gif" ChromeType="None" SuppressWebPartChrome="False" IsVisible="True" ListUrl="/Lists/FacilitiesList" AllowMultipleSelections="False" ZoneID="Header" __MarkupType="vsattributemarkup" __WebPartId="{768E2035-0461-4A09-8DDD-CA7020C2B23D}" WebPart="true" Height="" Width="615px"></WpNs0:SpListFilterWebPart>
    Alla Sanders

  • Add rows and sort JTable in the same program

    I would like to have a button to add rows to the JTable, but would also like to sort the data within the columns. This program can sort the data prior to clicking the 'add row' button. After I click the button, there is no new row, and I lose the ability to sort the column. Do you have any tips or advice as to what I can do to fix my program? Is it because I have to have the final code for SortFilterModel to work?
    Thanks
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class TableRowColumn extends JFrame
         private final static String LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
         JTable table;
         DefaultTableModel model;
         JPanel buttonPanel;
         JButton button;
         public TableRowColumn()
              Object[][] data = {
                        {"6", "K"},
                        {"5", "A"},
                        {"1", "Z"}
              String[] columnNames = {
                    "Number",
                    "Letter"
              model = new DefaultTableModel(data, columnNames);
                    //comment out this SortFilterModel line
                    final SortFilterModel sorter = new SortFilterModel(model);
                    //Change sorter to model
              table = new JTable(sorter);
              table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
              //  Add table and a Button panel to the frame
              JScrollPane scrollPane = new JScrollPane( table );
              getContentPane().add( scrollPane );
              buttonPanel = new JPanel();
              getContentPane().add( buttonPanel, BorderLayout.SOUTH );
              button = new JButton( "Add Row" );
              buttonPanel.add( button );
              button.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        model.addRow( createRow() );
                        int row = table.getRowCount() - 1;
                        table.changeSelection(row, row, false, false);
                        table.requestFocusInWindow();
                 //Set up double click handler for column headers and sort
                 table.getTableHeader().addMouseListener(new MouseAdapter(){
                        public void mouseClicked(MouseEvent event)
                          //check for click
                          if (event.getClickCount() < 2) return;
                       //find column of click and
                       int tableColumn = table.columnAtPoint(event.getPoint());
                       //translate to table model index and sort
                       int modelColumn = table.convertColumnIndexToModel(tableColumn);
                       sorter.sort(modelColumn);
         private Object[] createRow()
              Object[] newRow = new Object[2];
              int row = table.getRowCount() + 1;
              newRow[0] = Integer.toString( row );
              newRow[1] = LETTERS.substring(row-1, row);
              return newRow;
         public static void main(String[] args)
              TableRowColumn frame = new TableRowColumn();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
    }

    I attempted to modify the code in the correct way, but I ran into a problem near the bottom with the model.addRow(rowData); line. It has an error saying it can't find the addRow method. If I take away the model part, it will compile, but it will cause an infinite loop when I push the 'Add Row' button within the program. I didn't expect that to work, and I think it isn't calling the right model.
    I am aware that my code organization and design skills are not very good. I am a fan of basic assembly and low-level hardware languages for the most part.
    Thanks for your advice so far, it has been helpful.
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class TableRowColumn extends JFrame
         private final static String LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
         JTable table;
         public DefaultTableModel model;
         JPanel buttonPanel;
         JButton button;
         public TableRowColumn()
              Object[][] data = {
                        {"9", "C"},
                        {"5", "A"},
                        {"3", "B"}
              String[] columnNames = {
                    "Number",
                    "Letter"
              model = new DefaultTableModel(data, columnNames);
                    //comment out this SortFilterModel line
                    final SortFilterModel sorter = new SortFilterModel(model);
                    //Change sorter to model
              table = new JTable(sorter);
              table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
              //  Add table and a Button panel to the frame
              JScrollPane scrollPane = new JScrollPane( table );
              getContentPane().add( scrollPane );
              buttonPanel = new JPanel();
              getContentPane().add( buttonPanel, BorderLayout.SOUTH );
              button = new JButton( "Add Row" );
              buttonPanel.add( button );
              button.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        sorter.addRow( createRow() );
                        int row = table.getRowCount() - 1;
                        table.changeSelection(row, row, false, false);
                        table.requestFocusInWindow();
                 //Set up double click handler for column headers and sort
                 table.getTableHeader().addMouseListener(new MouseAdapter(){
                        public void mouseClicked(MouseEvent event)
                          //check for click
                          if (event.getClickCount() < 2) return;
                       //find column of click and
                       int tableColumn = table.columnAtPoint(event.getPoint());
                       //translate to table model index and sort
                       int modelColumn = table.convertColumnIndexToModel(tableColumn);
                       sorter.sort(modelColumn);
         private Object[] createRow()
              Object[] newRow = new Object[2];
              int row = table.getRowCount() + 1;
              newRow[0] = Integer.toString( row );
              newRow[1] = LETTERS.substring(row-1, row);
              return newRow;
         public static void main(String[] args)
              TableRowColumn frame = new TableRowColumn();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
    class SortFilterModel extends AbstractTableModel{
        public SortFilterModel(TableModel m){
            model = m;
            rows = new Row[model.getRowCount()];
            for (int i = 0; i < rows.length; i++) {
                rows[i] = new Row();
                rows.index = i;
    public void sort(int c){
    sortColumn = c;
    Arrays.sort(rows);
    fireTableDataChanged();
    public Object getValueAt(int r, int c) {
    return model.getValueAt(rows[r].index, c);
    public boolean isCellEditable(int r, int c){
    return model.isCellEditable(rows[r].index, c);
    public void setValueAt(Object aValue, int r, int c){
    model.setValueAt(aValue, rows[r].index, c);
    public int getRowCount() {
    return model.getRowCount();
    public int getColumnCount(){
    return model.getColumnCount();
    public String getColumnName(int c) {
    return model.getColumnName(c);
    public Class getColumnClass(int c){
    return model.getColumnClass(c);
    private class Row implements Comparable {
    public int index;
    public int compareTo(Object other) {
    Row otherRow = (Row)other;
    Object a = model.getValueAt(index, sortColumn);
    Object b = model.getValueAt(otherRow.index, sortColumn);
    if (a instanceof Comparable) {
    return ((Comparable)a).compareTo(b);
    else{
    return a.toString().compareTo(b.toString());
    public void addRow(Object[] rowData) {
    Row[] oldRows = new Row[rows.length];
    for (int i=0; i<rows.length; i++) {
    oldRows[i] = rows[i];
    rows = new Row[rows.length +1];
    for (int i=0; i < oldRows.length; i++) {
    rows[i] = oldRows[i];
    rows[oldRows.length] = new Row();
    rows[oldRows.length].index = oldRows.length;
    addRow (rowData);
    //model.addRow(rowData);
    fireTableDataChanged();
    private TableModel model;
    private int sortColumn;
    private Row[] rows;

  • Set attribute value using plugins

    Hi Experts,
    I am facing error when setting the value of attribute in the event "OnInvestigationStartedEvent". Any suggestion to fix the issue
    code:
                Session ses = onInvestigationStartedEvent.getSessionContext().getInterviewSession().getRuleSession();
                Attribute start = ses.getGlobalEntityInstance().getEntity().getAttribute("test_start_time");
                Date start_date = new Date();
                start.setValue(ses.getGlobalEntityInstance(), start_date);
    Error:
    25750 [http-apr-8080-exec-9] INFO com.oracle.determinations.engine.Session  - User setting attribute test_start_time, entity global, instance name global, session 1 to value 7/21/13 2:17 PM
    25752 [http-apr-8080-exec-9] ERROR com.oracle.determinations.web.platform.templatingengine.ErrorRenderer  - A unauthorised change to the Rule Session has been detected.
    com.oracle.determinations.interview.engine.exceptions.CorruptSessionException: A unauthorised change to the Rule Session has been detected.
      at com.oracle.determinations.interview.engine.data.local.RuleSessionManager.checkSessionIntegrity(RuleSessionManager.java:760)
      at com.oracle.determinations.interview.engine.data.local.RuleSessionManager.getRuleSession(RuleSessionManager.java:144)
      at com.oracle.determinations.interview.engine.local.LocalInterviewSession.getRuleSession(LocalInterviewSession.java:203)
      at com.oracle.determinations.interview.engine.data.model.InterviewEntityInstanceIdentifier.findEntityInstance(InterviewEntityInstanceIdentifier.java:73)
      at com.oracle.determinations.interview.engine.local.AttributeGoal.getNextScreen(AttributeGoal.java:112)
      at com.oracle.determinations.interview.engine.local.LocalInterviewSession.getNextScreen(LocalInterviewSession.java:222)
      at com.oracle.determinations.web.platform.controller.actions.InvestigateAction.getResource(InvestigateAction.java:65)
      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServlet.doGet(WebDeterminationsServlet.java:112)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.oracle.determinations.web.platform.util.CharsetFilter.doFilter(CharsetFilter.java:46)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
    Thanks,
    Vinay

    Vinay,
    When working in an Interview Engine event handler, you need to use Interview Engine objects to set values. Have a look at the example "Use the OnInterviewSessionCreatedEvent to pre-seed data into a newly created session" in the "Oracle Policy Automation Developer's Guide"
    Your code should look something like:
    // get the globalInstance from a new InterviewUserData;
    InterviewUserData data = new InterviewUserData();
    InterviewEntityInstance globalInstance = data.getGlobalInstance();
    // set the test_start_time
    Date start_date = new Date();
    globalInstance.setValue("test_start_time", start_date );
    // submit the data to the Interview session.
    TransactionResult result = session.submit(data);
    Hope this helps.
    Cheers
    Frank

  • Grouping and  setting attributes by group in data modeler

    Hi,
    I wanted the enhancement to hide foreign keys but until that comes I was thinking I could simply set all the foreign key I want not visible to a colour of white, which worked quite well.
    For the tables that are basically System such as Language Codes - I defined a Classification Type of System and set them to an identifiable colour to show they are connected but the connections will not be visible on the diagram.
    Then I tried to do the same for the Foreign keys but there is no way of setting a standard colour which can be changed.
    So I had to set each one to white, which is a pain but then I have white marks across my diagram which I may be able to live
    with. In most diagrammer mappers they have a send to back which would solve this - please???
    But then I come to the problem that I can't then see them to change them back as they are white ;)
    Is there any grouping mechanism that I can group together foreign keys so I can put in this temporary fix?
    So I guess I'm on
    1. Classification for Foreign Keys - any way to do this?
    2. Grouping and Sending groups to the front or back of the diagram.
    Thanks,
    p.

    Hi,
    you can use dynamic properties to build your own functionality - there is dynamic properties page for each object. you can create them using UI and use them in scripting.
    the following script uses dynamic property "cl_type" and check for value "t2"
    fkeys =  model.getFKIndexAssociationSet().toArray();
    //create color using integer
    color =   new java.awt.Color(16724838);
    for (var i = 0; i < fkeys.length; i++) {
    fk = fkeys;
    cl_type = fk.getProperty("cl_type");
    if(cl_type!=null){
    if(cl_type.indexOf("t2")==0){
    fk.setUseDefaultColor(false);
    fk.setBackgroundColor(color);
    fk.resetEdgeParams();
    }else{
    // set for other types or reset to default
    fk.setUseDefaultColor(true);
    fk.setBackgroundColor(null);
    fk.resetEdgeParams();
    you need to transform RGB color to integer - I found calculator here http://www.shodor.org/stella2java/rgbint.html
    Philip                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Iterating through listitems and set number value

    Hi,
    I have a problem with setting custom number value to list item column.
    I first wanted to do it with SPD workflow but it seem to be too tricky.
    So lets try with powershell, here's my case:
    I want to loop through library items and set value to column "OrderNumber".
    Result should be
    NAME       PRODUCT    ORDERNUMBER
    item             a                        1
    item             b                        2
    item             c                         3
    Here my script so far:
    if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction:SilentlyContinue))
        Add-PsSnapin Microsoft.SharePoint.PowerShell
    $web = Get-SPWeb http://sharepoint/subsite
    $list = $web.Lists["MyListName"]
    $listitems = $list.Items.Count
    for ($i=0; $i -le $listitems – 1; $i++)
      $item["OrderNumber"] = $i;
      $item.Update();
    but this does update only one item....
    I presume that i should use foreeach loop, but how to set $i variable in it?
    foreach ($item in $list.Items)
      $item["Number"] = Get-Random -Min 0 -Max 100;
      $item.Update();
    Thank you for any help!
    Regards, Antti
    Antti Astikainen

    hi
    just do small modification in your code
    f(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction:SilentlyContinue))
        Add-PsSnapin Microsoft.SharePoint.PowerShell
    $web = Get-SPWeb http://sharepoint/subsite
    $list = $web.Lists["MyListName"]
    $listitems = $list.Items.Count
    for ($i=0; $i -le $listitems – 1; $i++)
    $item=$listitems[$i];
    $item["OrderNumber"]
    = $i+1;
     $item.Update();
    Regards,
    Rajendra Singh
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful http://sharepointundefind.wordpress.com/

Maybe you are looking for

  • ""could not be found. window

    EVERY time I open Indesign by clicking on a previous document, I get this window.  Then I have to click cancel, and open the document through the menu bar.  It is very frustrating, as I just want to get to work and have to play around an extra few mi

  • Clearing control and Automatic clearing

    Hello, 1.Why Automatic clearing(Business Transactions) is different from Clearing Control? 2.How Automatic clearing is linked to the Contract account? 3.Is it possible to mention both automatic clearing control and clearing control at two different f

  • How do I paste text from another application into Adobe Story Plus?

    I am trying to paste in text from a client document into an Adobe script template but it doesn't seem possible, which is odd. Any ideas welcome.

  • My apple tv

    My apple TV won't connect to my internet. It says ' there is a problem with your connection please check in your settings and try again' but I am using the internet on my laptop right next to where I am trying to set up my apple TV and the signal str

  • Safari unexpectedly closes window and won't reopen till logout/in

    Since shortly after upgrading to OSX 10.5.2 I've been having a problem with Safari on my main computer a Powerbook G4 and with the Mac Mini it sync to. I've talked to Apple and they seem to think that it may be my bookmarks that are corrupted. The Sa