Repeating table Elements from Secondary source - InfoPath Dev
in

InfoPath Dev

Repeating table Elements from Secondary source

Last post 11-27-2006 05:53 PM by Nara Chilluvuri. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-19-2006 07:48 PM

    Repeating table Elements from Secondary source

    Hi,

    I am trying to create an InfoPath/SharePoint based test workflow for our manual testing requirements.

    In the past we have had these as Word documents which testers would print and execute manually and then save the results of the test to a sharepoint site for the test manager to track.

    I have now converted the test script template to an Infopath form and written some code to automatically save it to a InfoPath library.

    As this solution has progressed the test manager would now like to reference Test Data held in a XML document in the Test Script document. So I have set up the Test Data as a Secondary datasource and get all data on form load.

    The document structures are as follows:

    MAIN DATASOURCE (THE DOCUMENT)
    - MyTestTable (Group)
    - Name
    - ID
    - TestType
    - Summary (Group)
    - TestStatus
    - DateCompleted
    - Project
    - Phase
    - DefectIDs
    - TestCaseSteps (Group)
    - TestCaseTable (Repeating Group)
    - StepNumber
    - Condition
    - Result
    - Status
    - DefectID
    - TestData (Repeating Group)
    - Scenario
    - Value

    SECONDARY DATASOURCE (XML TESTDATA FILE)
    - TestData (Group)
    - DataSetDescription
    - TestDataPair (Repeating Group)
    - Scenario (Text - Dropdown list)
    - Value (Rich Text - Expression box)


    I have laid out the Test Script form in tables as follows:

    1) One main table "Test Details" to contain the Name, ID, TestType & all elements of the Summary group.

    2) A second table "Test Steps" with repeating rows containing the StepNumber, Condition, Result, TestData, Status & Defect ID elements

    3) A "Test Data" repeating Group is set up as a repeating table within the "Test Steps" table above with the Scenario, Value elements.

    The Scenario & Value in the main datasource are linked to the Scenario & Value from the Secondary datasource such that on load the Scenario drop down list displays all the scenarios listed in the Secondary source. On selection, the Value Expression box displays the matching value from the Secondary datasource. I have done this using rules and it works fine for a single row.

    MY PROBLEM
    If I have more than one row in the Test Steps table then, immaterial of which Scenario I select from the drop down box in the row, the value field always fetches the top most scenario from the secondary datasource used in any of the Steps and populates all Value fields in the entire test steps table with the same value. It seems to be because the rules are not referencing by row location from the Secondary datasource for each row in the test script table.


    E.g.

    Step Condition Result Scenario Value Status DefectID
    1 Condition1 Result1 Scn3 Val3

    When I enter the next row, the value in the first row changes

    1 Condition1 Result1 Scn3 Val1
    2 Condition1 Result1 Scn1 Val1

    When I enter the 3rd row, it automatically takes the value from the second row

    1 Condition1 Result1 Scn3 Val1
    2 Condition1 Result1 Scn1 Val1
    3 Condition1 Result1 Scn2 Val1

    As you can see, the value field for all rows in the repeating table fetch values from the highest Scenario in the source XML (Secondary datasource). Hope I have been clear in my description of the problem.

    My questions are around whether it is possible to achieve what I am trying? How do I ensure that the text in the Value ExpressionBox is based on the Scenario that has been selected for the specific row? I am willing to write code if required as I have done some rudimentary JScript code till date.

    Any help will be greatly appreciated.

    Thanks
    Nara

    Thanks
    Nara Chilluvuri
  • 11-24-2006 07:45 AM In reply to

    • Stavi
    • Top 100 Contributor
    • Joined on 12-13-2005
    • Posts 95

    Re: Repeating table Elements from Secondary source

    ok, thats a long post, in short, you want to get data from a row in a repeating table but always end up with data from first row?

    Assuming I understood correctly. Infopath uses the first row because it forgets which row you where using. To avoid this create a field outside your repeating table. Change your rules so the first thing it does is populate the extra field with the id for the selected row

    you can then use the extra field as reference for infopath to find the correct row
  • 11-27-2006 05:53 PM In reply to

    Re: Repeating table Elements from Secondary source

    Thanks for your response Stavi. I tried to be as clear as possible hence the loooooong post :D

    Anyway, after much researching and trying various options I finally found the answer based on a work-around from this post in the How-To section
    http://www.infopathdev.com/howto/tutorials/default.aspx?i=9f6fda3a14c14ac4924cf0a382928432

    I had tried various approaches but not really tried to understand the use of Current() until I came across this How-to.

    To sum it up,
    1) I created a drop down list 'Scenario' & an Expression box 'Value' both in a repeating table 'TestData'

    2) I also created a secondary Datasource 'TDList' to a Sharepoint list with the structure (ID, Scenario, Value)

    3) I then linked 'Scenario' to this datasource and made it display TDList.Scenario but save the Value as TDList.ID

    4) I linked the expression box to Data in the General properties tab and using the Fx button linked it to the 'Value' field in the TDList secondary datasource.

    5) I also applied a filter to the above Value field as follows:
    a) Select Field or Group 'Scenario' from Secondary source
    b) condition 'is equal to'
    c) Enter a Formula 'current()/Scenario' where Scenario is the name of the field linked to the Dropdown box as specified in step 1.

    As a result when I selected a scenario from TDList using the Dropdown list the Value expression box fetched the relevant row from the list based on the value of scenario in the current row of the repeating table.

    Hope this helps others.

    Cheers
    Nara
    Thanks
    Nara Chilluvuri
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.