Repeating tables and Current() - InfoPath Dev
in

InfoPath Dev

Repeating tables and Current()

Last post 07-31-2008 05:22 AM by GazM. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-22-2008 04:24 AM

    • GazM
    • Top 200 Contributor
      Male
    • Joined on 11-09-2005
    • England
    • Posts 54

    Repeating tables and Current()

    Hi

    I have searched the forum and found numerous posts relating to this question but still can't get it to work. I have an IP 2003 (SP2)form based on an Access DB with additional secondary datasources (xml files).

    The form has a repeating table with a drop down list box and a number of text boxes. The DDL gets a value from a secondary datasource (flat) and the first text box is populated with a corresponding value from the same datasource (filtered).

    When a row is inserted into the repeating table it takes the value for all subsequent text boxes as the first selection in the DDL.

    The formula for the text box is:

    xdXDocument:GetDOM("EWC 13")/dataroot/EWC-13/EWC-Code[../Waste = xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/d:SWMP-0_Details/d:SWMP-2_Forecast_Waste_13/@Material_Category]

     

    EWC-Code and Waste are fields in the secondary datasource (EWC 13)

    @Material Category is the text box

     

    I have tried current()/ and current()/.. in all possible position on the right hand side of the equation (and the left side) and the result is a blank text box.

     

    Has anyone any suggestions.

     

    Thanks

     

    Gary

  • 07-22-2008 07:10 PM In reply to

    Re: Repeating tables and Current()

    Hi, Gary:

    What field is the drop down list bound to? Not the values, but the list itself? Is @MaterialCategory from your main data source? Is Waste the field with the value you'd like to place, filtered, into @MaterialCategory? Is the formula in the default value for the text box bound to @MaterialCategory?

    Sorry for all the questions -- but a little more information would help....I'm sure you've searched the posts, but this from Greg Collins is very helpful.

    Hilary Stoupa

    Filed under:
  • 07-23-2008 12:10 AM In reply to

    • GazM
    • Top 200 Contributor
      Male
    • Joined on 11-09-2005
    • England
    • Posts 54

    Re: Repeating tables and Current()

    Hi Hilary

    The DDL is bound to @MaterialCategory (main data source) and looks up values from the Waste field in EWC 13 (secondary data source).

    The text box, @EWC_No, uses the formula EWC-Code[Waste = @Material_Category] (XPath shown in original question) for the default value and is bound to the main data source.

    The value displayed in the text box is EWC-Code, filtered from the Waste value in @Material_Category (part of xml file shown below)

    <?xml version="1.0" encoding="UTF-8"?>

    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2008-06-13T14:34:53">

    <EWC-13>

    <EWC-Code>13 01 01*</EWC-Code>

    <Waste>hydraulic oils</Waste>

    <Hazard-Code>A</Hazard-Code>

    </EWC-13>

    The filter works fine. If I select 'hydraulic oils' in the DDL, the text box displays '13 01 01*'  but uses the same selection as the first row for all subsequent rows of the repeating table. I can get current() to work if I change the text box to a DDL.

    Thanks

     Gary

  • 07-23-2008 07:57 AM In reply to

    Re: Repeating tables and Current()

    I would think that EWC-Code[Waste = current()/@Material_Category] would work.... but I'm sure your've tried that. I find it very perplexing that your formula with current() works when you change the control type....I'm sure you do, too! You do have the checkbox Update this value when the result of the formula is recalculated selected, right?

    Hilary Stoupa

  • 07-23-2008 11:16 PM In reply to

    • GazM
    • Top 200 Contributor
      Male
    • Joined on 11-09-2005
    • England
    • Posts 54

    Re: Repeating tables and Current()

    Hi

    Yes the checkbox Update this value when the result of the formula is recalculated is selected. I have tried it with the checkbox de-selected as well. I am very perplexed (to put it mildly), all of the forum posts, on this and other forums, say that it should work.

    Thanks

     Gary

  • 07-24-2008 08:04 AM In reply to

    Re: Repeating tables and Current()

    If your form is something you can share (I realize some companies have policies prohibiting such things) I'd be happy to take a look at it if you'd like to email me. Sometimes a second pair of eyes helps.

    Hilary Stoupa

  • 07-31-2008 05:22 AM In reply to

    • GazM
    • Top 200 Contributor
      Male
    • Joined on 11-09-2005
    • England
    • Posts 54

    Re: Repeating tables and Current()

    Hi

    Thanks to the wonderful Hilary Stoupa a solution has been found to this problem.

    The use of current()/ or current()/.. as described in the post by Greg Collins http://www.infopathdev.com/forums/p/5493/20643.aspx#20643 does not work with text boxes in IP 2003 but does with IP 2007.

    The solution can be found in this link

    http://www.infopathdev.com/blogs/matt/archive/2006/04/18/Automatically-Populate-Fields-from-a-Drop_2D00_Down-Selection.aspx

    Instead of using a formula in the text box to set the default value based on the DDL and a filter, a rule is used for the DDL field that sets the value for the text box.

    Gary

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.