Problem with current() function when trying to load xml data into a textbox - InfoPath Dev
in

InfoPath Dev

Problem with current() function when trying to load xml data into a textbox

Last post 10-05-2008 06:34 AM by chrobi. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 10-03-2008 10:36 AM

    • chrobi
    • Not Ranked
    • Joined on 10-03-2008
    • Posts 5

    Problem with current() function when trying to load xml data into a textbox

    Hello everyone,

    I'm working on the form, which is based on this article http://www.infopathdev.com/blogs/greg/archive/2005/07/14/Create-a-Repeating-Cascading-List-from-a-Hierarchical-Data-Source.aspx . I've succesfully done some modifications, which I need, but when I'm trying to get a value from a xml datasource to a textbox, i'm getting this error message ""my:Operation_type" does not point to a valid location path of a field or group."

    The specific steps I do are: Create a textbox > Properities > Value > Formula > Insert Field or Group > on the top I select my secondary source and find the value I need > Filter data > Add > Select a field or group > now I find the value, which is important for my condition > is equal to > use a formula > current()/my:Operation_type ... and there appears higher mentioned error.

     Could anyone give me and advice, how to solve this problem? Thank you very much for an answers.

  • 10-03-2008 11:14 AM In reply to

    Re: Problem with current() function when trying to load xml data into a textbox

    Hi -- what does your data source look like? The error you are getting means that the XPath in your formula is incorrect. If I know what your data source looks like, I may be able to help you. You can just type out your structure, for example:

    my:myFields
      my:repeatingGroup
        my:fieldOne
      my:Operation_type

    Hilary Stoupa

  • 10-03-2008 11:37 AM In reply to

    • chrobi
    • Not Ranked
    • Joined on 10-03-2008
    • Posts 5

    Re: Problem with current() function when trying to load xml data into a textbox

    Here's my XML source:

    <?xml version="1.0" encoding="UTF-8"?>
    <Technology>
      <Operation value="Kalení">
        <Operation_type value="Do Oleje">
          <Attribute_1 value="Teplota Austenitizace:" />
          <Attribute_2 value="Doba Austenitizace:" />
          <Attribute_3 value="Přípravek" />
        </Operation_type>
        <Operation_type value="Do Vody">
          <Attribute_1 value="Nějaká úplně jiná hodnota"/>
          <Attribute_2 value="Doba Austenitizace"/>
          <Attribute_3 value="Neco"/>
          <Attribute_4 value="Přípravek"/>
        </Operation_type>
      </Operation>
      <Operation value="Cementování">
        <Operation_type value="V Prášku">
          <Attribute_1 value="Druh prášku"/>
          <Attribute_2 value="Výdrž"/>
          <Attribute_3 value="Teplota"/>
        </Operation>
        <Operation_type value="Monocarb">
          <Attribute_1 value="teplota monokarbu"/>
          <Attribute_2 value="kterej monokarb"/>
          <Attribute_3 value="Přípravek"/>
        </Druh_operace>
      </Operation>
    </Technology>

    and here's my Main data source structure:

    "MyFields"
        "Operation_Group" (Repeating group)
              "Operation" (field) 
              "Operation_type" (field)
              "Attribute_1-value" (the field, which makes the problem)

    Thanks

  • 10-03-2008 12:01 PM In reply to

    Re: Problem with current() function when trying to load xml data into a textbox

    Okay, and what is the condition in the first part of your filter?

    my condition > is equal to > use a formula > current()/my:Operation_type ...

    from your initial post -- if you select Edit XPath in the Insert Formula dialog, what does the XPath look like?

    Hilary Stoupa

  • 10-03-2008 01:00 PM In reply to

    • chrobi
    • Not Ranked
    • Joined on 10-03-2008
    • Posts 5

    Re: Problem with current() function when trying to load xml data into a textbox

    First condition> In a Select a field or group dialog I'm choosing "Technology > Operation > Value" in a secondary data source, I hope that's what you wanted to know :-)

    If I don't have checked the Edit Xpath checkbox, it displays underlined "current()/Operation_type", if it is checked, it displays "current()/my:Operation_type"

  • 10-03-2008 02:40 PM In reply to

    Re: Problem with current() function when trying to load xml data into a textbox

    Hi:

    I mocked up a sample using the data structure described above and an XML file for a secondary data connection based off your XML. Here is the formula that worked for me:

    xdXDocument:GetDOM("XMLFile1")/Technology/Operation/Operation_type/Attribute_2/@value[../../@value =current()/../../my:Operation_type]

    When I added the XML file, each of the 'Attribute' elements had a 'value' attribute, and you can see the name of my secondary data connection is "XMLFile1". Using current()/../../my:Operation_type populated the text box with the filtered data....

    Hilary Stoupa

  • 10-04-2008 01:53 AM In reply to

    • chrobi
    • Not Ranked
    • Joined on 10-03-2008
    • Posts 5

    Re: Problem with current() function when trying to load xml data into a textbox

    Thanks a lot for your answers. I don't know why, but it still doesn't work in my project. Nevertheless after my hopeless trying how to fix it, I found out, that I don't even need current() function to achieve good result. Instead of a problem-formula in my filter I putted simple Operation_type value from my primary data source and believe or not, It works :-)

    If you want, I can upload my form somewhere, to allow you to check why your advice didn't work for me. It could be helpfull for another people having troubles with similar case.

  • 10-04-2008 05:57 PM In reply to

    Re: Problem with current() function when trying to load xml data into a textbox

    Please do -- you can attach it under the Options tab when you reply to this post -- I'd like to look at it!
    Hilary Stoupa

  • 10-05-2008 06:34 AM In reply to

    • chrobi
    • Not Ranked
    • Joined on 10-03-2008
    • Posts 5

    Re: Problem with current() function when trying to load xml data into a textbox

    No problem :-) Here it is ... I have already translated it into my native Czech language, but I think that for understanding purpouse it doesn't matter. Maybe the solution which I used is not very clean, bud as I said, it works :-)

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