User selection of table row possible - InfoPath Dev
in

InfoPath Dev

User selection of table row possible

Last post 07-16-2007 08:26 AM by nukkumatti. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-16-2007 04:43 AM

    User selection of table row possible

    Hi all,

    I have a form which allows the user to search in a products db. The query result is currently displayed in a repeating table control.

    Now, what I want to do is:

    - Let the user select one of the lines of the repqeating table control

    - Let the user press a button "add", upon which I want to programmatically get the values of the single row the user selected, and insert those values into a secondary repeating table.

    I have some code which inserts form values programmatically, but I didn't find anything yet for the topic of "how to get the values of the row a user selected".

    Hope this makes sense && greetings from Germany.
     

     

     

     

  • 07-16-2007 05:47 AM In reply to

    Re: User selection of table row possible

    What I have typically done is added a field to my DB table that is a flag column or used another field in the table for this purpose.

    Then my add button has a rule to update this field to x when checked. Next it copies the row where the field = x to your new section. And finally reset all fields to not x or default.  

    You should also be able to use the current function or get the key from the current row and the button to be able to select the data specifically but that is how I have done it in the past. 

  • 07-16-2007 06:40 AM In reply to

    Re: User selection of table row possible

    Hi Clay,

     

    thanks for the quick response. If I get you write, I need to add an additional column to my Products table called "Selected" or something. Then I need to write the "X" to the database ?

    Could you paste your XPath search string to get the row which the user selected. I am struggling with the XPath syntax (or. let's say, I have to get used to it ;-) ).

    This is how my template looks like

        <dfs:queryFields>
            <q:Products product_id="" SHORT_TEXT="" selected=""></q:Products>
        </dfs:queryFields>
        <dfs:dataFields>
            <d:Products product_id="" SHORT_TEXT="" selected=""></d:Products>
        </dfs:dataFields>
        <my:besuchsbericht>
            <my:bblines>
                <my:bb_prodid></my:bb_prodid>
                <my:bb_shorttext></my:bb_shorttext>
                <my:bb_freetext></my:bb_freetext>
                <my:bb_amount></my:bb_amount>
            </my:bblines>
        </my:besuchsbericht>

    So my user can enter product_id or short_text and search the db for this. Then, he can select one (or more) of the query result table and push the button.

    How would the XPath lookup fo the selected row look like ?

    objSource = dom.selectSingleNode("/dfs:myFields/dfs:datafields/d:Products"); var strSelected = null; strSelected = objSource.selectSingleNode("//product_id[@selected=='X']");

    doesnt work for me 

  • 07-16-2007 08:26 AM In reply to

    Re: User selection of table row possible

    Mal sehen ob ich das hier richtig versteh. I guess the xPath for your repeating table is dfs:myFields/dfs:datafields/d:Products so if you for example would like to get the values of the third row of your repeating values you had to use dfs:myFields/dfs:datafields[3]/d:Products but instead of the 3 as index you have to use current() function. just play arround with it a bit an i guess you should get it work. gonna have a look if i have a concrete example flying around somewhere. hope this helps already a bit. anyway you don't need to add a new column to your database table
    Listen to Motörhead cos they play Rock'n Roll :)
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.