Editable table with multiple rows

Hi All!
We're trying to develop some application in VC 7.0. That application should read data from some R/3 tables (via standard and custom functional modules), then display data to user and allow him/her to modify it (or add some data into table rows), and then save it back to R/3.
What is the best way to do that?
There's no problem with displaying data.
But when I try to add something to table (on portal interface), I'm able to use only first row of the table... Even if I fill all fields of that row, I'm not able to add data to second row, etc.
Second question. Is it possible to display in one table contents of output of several BAPIs? For example we have three bapis, one displaying user, second displays that user's subordinates, and the third one - that user's manager. And we want one resulting table...
And last. What is the best way to submit data from table view in VC (portal) to R/3 table? I understand that we should write some functional module, that puts data to R/3. I'm asking about what should be done in VC itself. Some button, or action...
Any help will be appreciated and rewarded :o)
Regards,
DK

Here are some former postings:
Editable table with multiple rows
and
Editable table with multiple rows
Are you on the right SP-level?
Can you also split up your posting: one question, one posting? This way you get faster answers, as people might just browse the headers.

Similar Messages

  • TO DRAW A TABLE WITH MULTIPLE ROWS AND MULTIPLE COLOUMNS IN FORM

    Hi,
       How to draw a table with multiple rows and columns seperated by lines in form printing?

    check this
    http://sap-img.com/ts003.htm
    Regards
    Prabhu

  • Input enabled table with multiple rows

    Hi All,
    I have a scenario to create a table in webdynpro for abap. This is a user interface. Here user will be providing value for tabe in multiple rows. And once user will press the Save button then all the rows of table will be read and will be saved in database.
    My problem is the table is displaying only one row as input enabled not all the rows. Can anyone please help on this? Points will be assured.
    If I am providing rowCount = 2. Or more than 2 then it is creating short dump.
    Thanks & Regards,
    Ashvender

    Hi Ashvender
    In init method of your view :
    Read the context node with which u have binded the table control fields.
    Create a  internal table same as structure of your context node
    append blank records for as many editable rows u wanted
    Bind the internal table.
    Ex:
    node_table TYPE REF TO if_wd_context_node,
    elem_table TYPE REF TO if_wd_context_element,
    stru_table TYPE if_v_table=>element_flight ,
    lt_stru_table TYPE if_v_table=>elements_flight .
    node_table = wd_context->get_child_node( 'TABLE' ).
    clear: stru_table.
    do 5 times.
    append stru_table to it_table.
    enddo.
    node_table->bind_table( it_table).
    Regards
    Vishal Kapoor

  • Issue in retrieving all the records from ADF Table with multiple row

    Hi,
    As per my requirement, I need to fill the table with multi selected LOV values and when user clicks on commit, I need to save them to database.
    I am using ADF 11g, Multi select table. Using the below ADD method, I am able to add the records but if user clicks on cancel, I need to remove those from view and clear the table as well.
    But the Issue I am facing is, in my cancel method, always I am getting half of the records. Lets assume table contains 100 records but in my cancel method, I am getting only 50 records.
    Please let me know what is the issue in my source code.
    ADD Method:
    public void insertRecInCMProcessParamVal(String commType, String processType, Number seqNumber){       
    try{
    Row row = this.getCmProcessParamValueView1().createRow();
    row.setAttribute("ParamValue7", commType);
    row.setAttribute("ProcessType", processType);
    row.setAttribute("CreationDate", new Date());
    row.setAttribute("CreatedBy", uid);
    row.setAttribute("ParamValueSeqNum", seqNumber);
    row.setAttribute("ProcessedFlag", "N");
    this.getCmProcessParamValueView1().insertRow(row);
    }catch(Exception e){           
    e.printStackTrace();
    Table Code:
    <af:table value="#{bindings.CmProcessParamValueView11.collectionModel}"
    var="row"
    rows="#{bindings.CmProcessParamValueView11.rangeSize}"
    emptyText="#{bindings.CmProcessParamValueView11.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.CmProcessParamValueView11.rangeSize}"
    rowBandingInterval="1"
    selectedRowKeys="#{bindings.CmProcessParamValueView11.collectionModel.selectedRow}"
    selectionListener="#{bindings.CmProcessParamValueView11.collectionModel.makeCurrent}"
    rowSelection="multiple"
    binding="#{backingBeanScope.backing_app_RunCalcPage.t1}"
    id="t1" width="100%" inlineStyle="height:100px;" >
    <af:column sortProperty="ParamValue6"
    sortable="true"
    headerText="#{bindings.CmProcessParamValueView11.hints.ParamValue6.label}"
    id="c1" visible="false">
    <af:inputText value="#{row.bindings.ParamValue6.inputValue}"
    label="#{bindings.CmProcessParamValueView11.hints.ParamValue6.label}"
    required="#{bindings.CmProcessParamValueView11.hints.ParamValue6.mandatory}"
    columns="#{bindings.CmProcessParamValueView11.hints.ParamValue6.displayWidth}"
    maximumLength="#{bindings.CmProcessParamValueView11.hints.ParamValue6.precision}"
    shortDesc="#{bindings.CmProcessParamValueView11.hints.ParamValue6.tooltip}"
    id="it3">
    <f:validator binding="#{row.bindings.ParamValue6.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="ParamValue7"
    sortable="true"
    headerText="Comm Type"
    id="c2">
    <af:inputText value="#{row.bindings.ParamValue7.inputValue}"
    label="#{bindings.CmProcessParamValueView11.hints.ParamValue7.label}"
    required="#{bindings.CmProcessParamValueView11.hints.ParamValue7.mandatory}"
    columns="#{bindings.CmProcessParamValueView11.hints.ParamValue7.displayWidth}"
    maximumLength="#{bindings.CmProcessParamValueView11.hints.ParamValue7.precision}"
    shortDesc="#{bindings.CmProcessParamValueView11.hints.ParamValue7.tooltip}"
    id="it4">
    <f:validator binding="#{row.bindings.ParamValue7.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="ParamValue8"
    sortable="true"
    headerText="#{bindings.CmProcessParamValueView11.hints.ParamValue8.label}"
    id="c3" visible="false">
    <af:inputText value="#{row.bindings.ParamValue8.inputValue}"
    label="#{bindings.CmProcessParamValueView11.hints.ParamValue8.label}"
    required="#{bindings.CmProcessParamValueView11.hints.ParamValue8.mandatory}"
    columns="#{bindings.CmProcessParamValueView11.hints.ParamValue8.displayWidth}"
    maximumLength="#{bindings.CmProcessParamValueView11.hints.ParamValue8.precision}"
    shortDesc="#{bindings.CmProcessParamValueView11.hints.ParamValue8.tooltip}"
    id="it2">
    <f:validator binding="#{row.bindings.ParamValue8.validator}"/>
    </af:inputText>
    </af:column>
    </af:table>
    Backing Bean Code:
    DCBindingContainer dcBindings=(DCBindingContainer)getBindings();
    DCIteratorBinding dcIterator=dcBindings.findIteratorBinding("CmProcessParamValueView1Iterator");
    RowSetIterator rs = dcIterator.getRowSetIterator();
    System.out.println("In Cancel Row Count is : "+ rs.getRowCount());
    if (rs.getRowCount() > 0) {
    Row row = rs.first();
    row.refresh(Row.REFRESH_UNDO_CHANGES);
    row.remove();
    while (rs.hasNext()) {
    int count = rs.getRowCount();
    System.out.println("Count is : "+ count);
    Row row = rs.next();
    System.out.println("Row === "+ row);
    if(row != null){                   
    row.refresh(Row.REFRESH_UNDO_CHANGES);
    row.remove();
    Thanks.

    Issue resolved.
    remove selectionListener and selectedRowKeys....
    code to get all the selectedRows.
    RowSetIterator rs = dcIterator.getRowSetIterator();
    RowKeySet rks = this.t1.getSelectedRowKeys();
    Iterator rksIter = rks.iterator();
    while (rksIter.hasNext()) {
    List l = (List) rksIter.next();
    Key key = (Key)l.get(0);
    Row row = rs.getRow(key);
    Thanks.

  • Adobe Form Table with multiple rows

    Hi,
       I am facing problem with mutliple rows item in the table. A row which doesn't have data is occuping the space in the form. Need solution to  remove the space .
    i used the code in Form CALC in client.
    if (HasValue($) == 0)
    then $.presence = "hidden"
    else $.presence = "visible"
    endif
      But it is not working. And also i need display a text field based on the condition.in the form How can i write code in the Form CALC. Plz help me out in this.
    Thanks & Regards,
    Narasimha

    Hi Narsimha,
    First of all why is your blank row getting displayed?Adobe automatically takes care of this. It would display a new row only if there's flow of data in the next row. i.e. if you have a new item to be displayed in this new row.
    You must check your table properties first.
    For hiding fields i can help you.But I m not sure if this issue is still open.
    Swar.

  • Powerpivot excel pivot-tables with multiple rows (problem expand / collapse)

    Hello, 
    I made a pivot table with powerpivot so I get kind of data: 
    The problem I have is that when I reduced the city of Bordeaux for example, given this city are reduced both that really interests me as the other non-company (all cities Bordeaux are reduced). 
    I would like to know how to get it is there that the city which interests me is reduced?

    Hi,
    As I have no idea of your PowerPivot data. And I have a litter confused about 
    'the city which interests me is reduced' .
    Did you want to get the city whose volume(maybe sales volume) is reduced than last year ?
    If so,I suggest you create a calculated column in PowerPivot to get the YTD of previous year using DAX. then in pivot table you can use this dimension to do a filter.
    http://www.powerpivotblog.nl/get-the-ytd-of-same-period-last-year-using-dax/
    If I misunderstand you, please let me know. And if it is convenient for you, please share your workbook here.
    Wind Zhang
    TechNet Community Support

  • Empty table with multiples rows and 2 columns for processing data

    Hi,
    I am very new to adobe forms. I have the requirement that the user will enter some data in the table rows and I should process them to update in a z-table as well as use that data for MB1A tcode. I am not sure what to use here. Which is the best. I dont know anything about webdynpro. Can it be done directly in SFP transaction without using web-dynpro?
    Also if I need more rows I should give them the option to add rows. How does the submit button work here when the user enters the data in all the 10 rows.
    I heard about web services and I know a little about it, can it be achieved though that? Please help me. I need to finish 4 forms like this and each form should take me to the next form level.
    Kaps.

    Hello!
    You don´t have to tell me, I am the ABAP developer as well. I know that there is very little like ..."career" value in learning scripting in some obscure languages like Java script or Form Calc for Adobe forms. But trust me, you won´t have to learn much. You will have to learn how to manipulate the presence of form fields (or variable values, but that is the same like setting the presence to hidden, you only pass a constant or any other value).
    In the mentioned guide, in the last chapter you can just copy and next paste the ready to use scripting bacis. I think you should find the add/ remove row scripts there as well.
    The right scenario is not always easy to pick, consider this:
    - how many forms at the same time will the user have to fill? (if one --> offline, if more --> portal/ WD)
    - do you want the user to work with the NW portal? do you have licenses for the new users? (WD)
    - how often will the people fill their forms? how important the processes are? how many values will come from the backend tables (like how many search helps you would use if you can)
    etc. etc.
    Hope that clarifies things a little for you
    regards Otto

  • Table row with multiple row

    Hi All,
    I am using NWDS 2004
    I want to have a table with multiple rows in a row.
    Can any one help ?
    Thanks

    hi Akhilesh,
    Use tree table for your requirement.
    [Tree Table Tutorial|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/de59f7c2-0401-0010-f08d-8659cef543ce]
    Hope this helps!
    Monalisa

  • JTable with Multiple Row Header

    well, Im do an application thats need formated ISOS Sheets, and most of them have a Table with Multiple Row Header , and Groupable Header, and both of them. I have the .java and in the class MultipleRowHeaderExample calls a class AttributiveCellTableModel for setColumnIdentifiers() and setDataVector() the cue is why this print stack :
    Exception in thread "main" java.lang.StackOverflowError
         at java.util.Vector.<init>(Unknown Source)
         at java.util.Vector.<init>(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:54)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
         at jp.gr.java_conf.tame.swing.table.AttributiveCellTableModel.setDataVector(AttributiveCellTableModel.java:55)
         at javax.swing.table.DefaultTableModel.setColumnIdentifiers(Unknown Source)
    .if in main class, have initialized the data, and column vars
    public class MultipleRowHeaderExample extends JFrame {
      Object[][] data;
      Object[] column;
      JTable table;
      MultiSpanCellTable fixedTable;
      public MultipleRowHeaderExample() {
        super( "Multiple Row Header Example" );
        setSize( 400, 150 );
        data =  new Object[][]{
            {"SNo."    ,"" },
            {"Name"    ,"1"},
            {""        ,"2"},
            {"Language","1"},
            {""        ,"2"},
            {""        ,"3"}};
        column = new Object[]{"",""};
        AttributiveCellTableModel fixedModel = new AttributiveCellTableModel(data, column) {
          public boolean CellEditable(int row, int col) {
            return false;
        };

    What's the code in AttributiveCellTableModel?
    * (swing1.1beta3)
    package jp.gr.java_conf.tame.swing.table;
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    * @version 1.0 11/22/98
    public class AttributiveCellTableModel extends DefaultTableModel {
      protected CellAttribute cellAtt;
      public AttributiveCellTableModel() {
        this((Vector)null, 0);
      public AttributiveCellTableModel(int numRows, int numColumns) {
        Vector names = new Vector(numColumns);
        names.setSize(numColumns);
        setColumnIdentifiers(names);
        dataVector = new Vector();
        setNumRows(numRows);
        cellAtt = new DefaultCellAttribute(numRows,numColumns);
      public AttributiveCellTableModel(Vector columnNames, int numRows) {
        setColumnIdentifiers(columnNames);
        dataVector = new Vector();
        setNumRows(numRows);
        cellAtt = new DefaultCellAttribute(numRows,columnNames.size());
      public AttributiveCellTableModel(Object[] columnNames, int numRows) {
        this(convertToVector(columnNames), numRows);
      public AttributiveCellTableModel(Vector data, Vector columnNames) {
        setDataVector(data, columnNames);
      public AttributiveCellTableModel(Object[][] data, Object[] columnNames) {
        setDataVector(data, columnNames);
      public void setDataVector(Vector newData, Vector columnNames) {
        if (newData == null)
          throw new IllegalArgumentException("setDataVector() - Null parameter");
        dataVector = new Vector();
        setColumnIdentifiers(columnNames);
        dataVector = newData;
        cellAtt = new DefaultCellAttribute(dataVector.size(),
                                           columnIdentifiers.size());
        newRowsAdded(new TableModelEvent(this, 0, getRowCount()-1,
               TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      @Override
      public void setColumnIdentifiers(Vector arg0) {
              // TODO Auto-generated method stub
              super.setColumnIdentifiers(arg0);
      public void addColumn(Object columnName, Vector columnData) {
        if (columnName == null)
          throw new IllegalArgumentException("addColumn() - null parameter");
        columnIdentifiers.addElement(columnName);
        int index = 0;
        Enumeration enumeration = dataVector.elements();
        while (enumeration.hasMoreElements()) {
          Object value;
          if ((columnData != null) && (index < columnData.size()))
           value = columnData.elementAt(index);
          else
         value = null;
          ((Vector)enumeration.nextElement()).addElement(value);
          index++;
        cellAtt.addColumn();
        fireTableStructureChanged();
      public void addRow(Vector rowData) {
        Vector newData = null;
        if (rowData == null) {
          newData = new Vector(getColumnCount());
        else {
          rowData.setSize(getColumnCount());
        dataVector.addElement(newData);
        cellAtt.addRow();
        newRowsAdded(new TableModelEvent(this, getRowCount()-1, getRowCount()-1,
           TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      public void insertRow(int row, Vector rowData) {
        if (rowData == null) {
          rowData = new Vector(getColumnCount());
        else {
          rowData.setSize(getColumnCount());
        dataVector.insertElementAt(rowData, row);
        cellAtt.insertRow(row);
        newRowsAdded(new TableModelEvent(this, row, row,
           TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
      public CellAttribute getCellAttribute() {
        return cellAtt;
      public void setCellAttribute(CellAttribute newCellAtt) {
        int numColumns = getColumnCount();
        int numRows    = getRowCount();
        if ((newCellAtt.getSize().width  != numColumns) ||
            (newCellAtt.getSize().height != numRows)) {
          newCellAtt.setSize(new Dimension(numRows, numColumns));
        cellAtt = newCellAtt;
        fireTableDataChanged();
      public void changeCellAttribute(int row, int column, Object command) {
        cellAtt.changeAttribute(row, column, command);
      public void changeCellAttribute(int[] rows, int[] columns, Object command) {
        cellAtt.changeAttribute(rows, columns, command);
    }that's it

  • Web dynpro screen with multiple rows with columns that can be edited

    Web dynpro screen with multiple rows with columns that can be edited individually:
    Hi
    I am busy creating a screen in web dynpro for ABAP which we would like to make available via Portal ESS (Portal 7).
    I need to add 'n type of table (or almost something like Excel) or something in which someone can type a few paycode numbers (there should be lets say 10 blank rows in which info can be typed in and if I click on a button or so, more rows must be added if necessary.  Then in the other colums stuff like amounts must be entered which one should also be able to edit then and there.
    Can anyone assist in what I can use for this?  There does not seem to be some existing element that I can use.
    Help will be appreciated.
    Regards
    Debbie

    Hi Debbie,
    Whiel Creating table you need to be care full that use chose INPUT FIELD as the CELL EDITOR. Just guessing that if ur table is not editable u might have choosen TextView as default cell editor type.
    check link for details on TABLE UI
    [http://help.sap.com/saphelp_erp2005/helpdata/EN/b5/ac884118aa1709e10000000a155106/frameset.htm]
    easy way is to first add UI ELEMENT TABLE to your VIEW, then right click over it & select create binding from context. After you have a pop up where you can select what columns you want what should be its cell editor etc.
    Greetings
    Prashant

  • How to create editable table with one empty row ?

    I'm looking for solution how to create editable table with one empty row using ADF BC. I have seen this solution in application that was created in JHeadstart and it's very well idea to use it insead of creation form.

    hammm, i do it this:
    drop the VO on the page, select Table->ADF Table....
    so, drop the botton create, from de VO->operations->create (the firts), and right botton (mouse) Edit binding....
    in Data collection select the VO, in Select an action select CreateInsert
    luck

  • How to create a table with multiple select on???

    Hi all,
            I am  new to webdynpro and my requirement is to create a  table with multiple selection on.I have to add abt 10 rows in the table but only 5 rows should be visible and moreover a verticalscroll should be available to view other rows.Can anybody explain me in detail how to do that.Please reply as if you are explaining  to a newcomer.Reply ASAP as i have to do it today.
                                                                           Thanxs

    Hi,
    1. Create a value node in your context name Table and set its cardinality to 0:n
    2. Create 2 value attributes within the Table node name value1 and value2
    3. Goto Outline view> Right click on TransparentUIContainer>Apply Template> Select Table>mark the node Table and it's attributes.
    you have created a table and binded its value to context
    Table UI properties
    4.Set Selection Mode to Multi
    5.Set Visible Row Count to 5
    6.ScrollableColCount to 5
    In your implemetaion, you can add values to table as follow:
    IPrivate<viewname>.ITableElement ele = wdContext.nodeTable().createTableElement();
    ele.setValue1(<value>);
    ele.setValue2(<value>);
    wdContext.nodeTable().addElement(ele);
    The above code will allow you to add elements to your table node.
    Regards,
    Murtuza

  • Select on table with 1800 rows is slow

    I have a table with 1800 rows. Each entry has a geometry position and a geometry polygon around the position. I am using the polygon to detect which (other) entries are near the current entry.
    In the following testdata and the subsequent query, i am filtering on 625 (of 1865) rows, and then using the .STContains-method to finding other rows (the testdata is fully found by this query, in the live database the values are not so regular as in the testdata.
    The query take 6500 ms. In the live database, only 800 records are (yet) in the table, and it takes 2200 ms. 
    select SlowQueryTable.id
    from SlowQueryTable
    inner join dbo.SlowQueryTable as SlowQueryTableSeen
    on SlowQueryTable.[box].STContains(SlowQueryTableSeen.position) = 1
    where SlowQueryTable.userId = 2
    (The query in the live system is even more complex, but this is main part of it and even simplified as it is just takes too long).
    This script generates test data and runs the query:
    -- The number table is just needed to generate test data
    CREATE TABLE [dbo].[numbers](
    [number] [int] NOT NULL
    go
    declare @t table (number int)
    insert into @t select 0 union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9
    insert into numbers
    select * from
    select
    t1.number + t2.number*10 + t3.number*100 + t4.number*1000 as x
    from
    @t as t1,
    @t as t2,
    @t as t3,
    @t as t4
    ) as t1
    order by x
    go
    -- this is the table which has the slow query. The Columns [userId], [position] and [box] are the relevant ones
    CREATE TABLE [dbo].SlowQueryTable(
    [id] [int] IDENTITY(1,1) NOT NULL,
    [userId] [int] NOT NULL,
    [position] [geometry] NOT NULL,
    [box] [geometry] NULL,
    constraint SlowQueryTable_primary primary key clustered (id)
    create nonclustered index SlowQueryTable_UserIdKey on [dbo].SlowQueryTable(userId);
    --insert testdata: three users with each 625 entries. Each entry per user has its unique position, and a rectangle (box) around it.
    -- In the database in question, the positions are a bit more random, often tens of entries have the same position. The slow query is nevertheless visible with these testdata
    declare @range int;
    set @range = 5;
    INSERT INTO [dbo].SlowQueryTable (userId,position,box)
    select
    users.number,
    geometry::STGeomFromText('POINT (' + convert(varchar(15), X) + ' ' + convert(varchar(15), Y) + ')',0),
    geometry::STPolyFromText('POLYGON ((' + convert(varchar(15), X - @range) + ' ' + convert(varchar(15), Y - @range) + ', '
    + convert(varchar(15), X + @range) + ' ' + convert(varchar(15), Y - @range) + ', '
    + convert(varchar(15), X + @range) + ' ' + convert(varchar(15), Y + @range) + ', '
    + convert(varchar(15), X - @range) + ' ' + convert(varchar(15), Y + @range) + ','
    + convert(varchar(15), X - @range) + ' ' + convert(varchar(15), Y - @range) + '))', 0)
    from (
    select
    (numberX.number * 40) + 4520 as X
    ,(numberY.number * 40) + 4520 as Y
    from numbers as numberX
    cross apply numbers as numberY
    where numberX.number < (1000 / 40)
    and numberY.number < (1000 / 40)) as positions
    cross apply numbers as users
    where users.number < 3
    CREATE SPATIAL INDEX [SlowQueryTable_position]
    ON [dbo].SlowQueryTable([position])
    USING GEOMETRY_GRID
    WITH (
    BOUNDING_BOX = ( 4500, 4500, 5500, 5500 ),
    GRIDS =(LEVEL_1 = HIGH,LEVEL_2 = HIGH,LEVEL_3 = HIGH,LEVEL_4 = HIGH),
    CELLS_PER_OBJECT = 64, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    go
    ALTER INDEX [SlowQueryTable_position] ON [dbo].SlowQueryTable
    REBUILD;
    go
    CREATE SPATIAL INDEX [SlowQueryTable_box]
    ON [dbo].SlowQueryTable(box)
    USING GEOMETRY_GRID
    WITH ( BOUNDING_BOX = ( 4500, 4500, 5500, 5500 ) ,
    GRIDS =(LEVEL_1 = HIGH,LEVEL_2 = HIGH,LEVEL_3 = HIGH,LEVEL_4 = HIGH),
    CELLS_PER_OBJECT = 64, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    go
    ALTER INDEX [SlowQueryTable_box] ON [dbo].SlowQueryTable
    REBUILD;
    go
    SET STATISTICS IO ON
    SET STATSTICS TIME ON
    -- this is finally the query. it takes about 6500 ms
    select SlowQueryTable.id
    into #t1
    from SlowQueryTable
    inner join dbo.SlowQueryTable as SlowQueryTableSeen
    on SlowQueryTable.[box].STContains(SlowQueryTableSeen.position) = 1
    --on SlowQueryTable.position.STDistance(SlowQueryTableSeen.position) < 5
    where SlowQueryTable.userId = 2
    drop table #t1
    drop table SlowQueryTable
    drop table numbers
    Using an explicit index hint does do the job, but then the query gets slow if i change the where clause:
    select SlowQueryTable.id
    into #t1
    from SlowQueryTable
    with (index([SlowQueryTable_box]))
    inner join dbo.SlowQueryTable as SlowQueryTableSeen
    on SlowQueryTable.[box].STContains(SlowQueryTableSeen.position) = 1
    where SlowQueryTable.userId = 2
    leads to 600ms, and changing the where clause
    where SlowQueryTable.id = 100
    slows it again down to 1200ms.  Filtering on ID get massively slowed down when using index hint on the spatial index.
    Since the table in the live system will grow to 10000+ rows, and the query is called often by users, I badly need a more efficient query.
    Do I have to create a different queries for each use-case, some with index hints and some without?

    I've run your example and can confirm your results. There's a couple of things that I noticed though.
    After looking at query plans, it's not a matter of "with spatial index" vs. "without spatial index". You have two spatial indexes, one on each column (position and box). When you don't hint the "box" spatial index, the query
    uses the "position" spatial index. Because of what they are indexing (points vs. polygons), the "box" spatial index requires a lot more IO. With some (non-spatial) predicates, the "box" spatial index gives better performance,
    with others the "position" one does. I've yet to figure out exactly why (short on time, I might get back to it in future), but you can examine query plans and use the spatial index diagnostic procs (e.g. sp_help_spatial_geometry_index_xml ) in
    addition to the diagnostics you're running to see why and if you can find a better performing plan/index.
    Bear this in mind. Given a choice of multiple spatial indexes, the SQL Server query optimizer is not able to choose (for the most part, IO etc. aside), which one is best. Also, there is usually only one choice of spatial query plan shape, in general. If
    your query is more complex than the one in your example, you might benefit by breaking it in two: one query to filter out all the rows and predicates that don't use a spatial index and one query that uses the spatial index on the subset. I've had good
    luck with this other situations with complex queries involving spatial predicates. This method may not be applicable to a spatial query as simple as the one in your example, however.
    Hope this helps, Bob 

  • Can we bind a single external table with multiple files in OWB 11g?

    Hi,
    I wanted to ask if it is possible to bind an external table with multiple source files at same or different locations? Or an external table has to be bound to a single source file and a single location.
    Thanks in advance,
    Ann.
    Edited by: Ann on Oct 8, 2010 9:38 AM

    Hi Ann,
    Can you please help me out by telling me the steps to accomplish this. Right click on the external table in project tree, from the menu choose Configure,
    then in opened Configuration Properties dialog window right clock on Data Files node and choose from menu Create -
    you will get new record for file - specify Data File Name property
    Also link from OWB user guide
    http://download.oracle.com/docs/cd/B28359_01/owb.111/b31278/ref_def_flatfiles.htm#i1126304
    Regards,
    Oleg

  • I have regisetred a EIT with multiple rows Yes, can we change it NO now.

    I have registered a EIT with multiple rows Yes, can we change it NO now.

    Hi,
    Yes you can change this through back-end.
    Register extra information (types) concurrent program run the package HR_REGISTER_EITS and insert definintion of an EIT in respective INFO_TYPES tabel for example if person EIT then definition is stored in PER_PEOPLE_INFO_TYPES.
    In this table we have column MULTIPLE_OCCURENCES_FLAG which can have value as Y or N, Y - Multiple entries allowed, N - Multiple entries not allowed.
    You need to update the value of this flag to N for your EIT definition and you are done.
    Thanks,
    Sanjay

Maybe you are looking for

  • BW Report mismatching with R3 data

    Hi, I am facing very strange issue.For one of BW Reports -we are reporting -billing doc data with details like quantity,net value in BW report.While for some of biiling doc quantity is matching with SAP table-VBRK /VF03.There is no restrcition at que

  • How new does my ipod need to be to work with my new 2011 Audi A4?

    I don't own an ipod currently, however my new 2011 Audi A4 has music interface that allows me to connect my ipod in the glove box and then conrtol it from my car's radio.  I have been told a "4th generation" ipod or newer will work.  Can't tell what

  • Customizing the CONCATENATE formula?

    I am creating a 1000+ url redirect file. I one column I have the url giving the 404 error, in the next column the correct URL, and in the third column the formula =CONCATENATE(A, C) This gives me the first two columns combined, great, but now I need

  • Regular expressions: find files with exactly 'n' digits in a row

    Hi there, I want to filter files that contain only a fixed number of digits, but not more (at least not in after the digits). For example, I have 01.mp3 02.mp3 test10.txt test000110101010.txt 04.flac and for n=2 I want to get all files except 'test00

  • Access Denied ix4-300d

    I tried enable SSH on Iomega ix4-300d but always return Access Denied. Follow this steps: Point your web browser to the following address: http://xxx.xxx.xxx.xxx/manage/diagnostics.html. Click the "Allow remote access for support (SSH and SFTP), and