Store List value (not ID) in an expression box - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Store List value (not ID) in an expression box

Last post 10-26-2011 11:40 AM by Hilary Stoupa. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 10-26-2011 08:49 AM

    • stara
    • Top 200 Contributor
    • Joined on 10-20-2010
    • Posts 54

    Store List value (not ID) in an expression box

    I have a drop-down list bound to secondary data source and displaying value, but stores ID. How would I store the actual value in an Expression box? Is it possible to achieve this?  I used the following formula in expression box but doesn't seem to work:

    xdXDocument:GetDOM("Review Status")/dfs:myFields/dfs:dataFields/d:tbl_review_status/@status_text[@pk_review_status = @fk_review_status]

     Note: status_text and pk_review_status are from secondary data source

    fk_review_status is in the Main connection (drop down field)

     Please let me know if above formula is incorrect.

     

    Thanks

    Stara

     

     

     

  • 10-26-2011 09:37 AM In reply to

    Re: Store List value (not ID) in an expression box

    Looks like it should be this:

    xdXDocument:GetDOM("Review Status")/dfs:myFields/dfs:dataFields/d:tbl_review_status[@pk_review_status = @fk_review_status]/@status_text

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-26-2011 10:43 AM In reply to

    • stara
    • Top 200 Contributor
    • Joined on 10-20-2010
    • Posts 54

    Re: Store List value (not ID) in an expression box

    I tried the above. But I get following error message:

     "xdXDocument:GetDOM("Review Status")/dfs:myFields/dfs:dataFields/d:tbl_review_status/@fk_review_status" does not point to a valid location path of a field or group.

     

    Thanks

  • 10-26-2011 10:51 AM In reply to

    Re: Store List value (not ID) in an expression box

    Where is @fk_review_status located in your main data source? Can you right click on it and select "Copy XPath"? (IP 2007 & 2010)

    Where are you placing your expression box on your form? Inside a section? A repeating section or table?

    Hilary Stoupa

  • 10-26-2011 11:12 AM In reply to

    • stara
    • Top 200 Contributor
    • Joined on 10-20-2010
    • Posts 54

    Re: Store List value (not ID) in an expression box

    Yes @fk_review_status  is in Main data source. I'm using 2003 (Copy xPath is not available). Yes expression box is in the same form in a repeating table.

     

    Thanks

  • 10-26-2011 11:18 AM In reply to

    Re: Store List value (not ID) in an expression box

    Is @fk_review_status in the same repeating table that you are putting the expression box in?

    If so, this may work:

    xdXDocument:GetDOM("Review Status")/dfs:myFields/dfs:dataFields/d:tbl_review_status[@pk_review_status = current()/@fk_review_status]/@status_text

    But it is hard to know without seeing your form. You can attach a copy of your template to the Options tab if you'd like someone to take a look.

    Hilary Stoupa

  • 10-26-2011 11:31 AM In reply to

    • stara
    • Top 200 Contributor
    • Joined on 10-20-2010
    • Posts 54

    Re: Store List value (not ID) in an expression box

    It worked. Thanks so much.

    So what does Current() mean - Does it get current value of fk_status?

     

    Thanks a lot, 

     

  • 10-26-2011 11:40 AM In reply to

    Re: Store List value (not ID) in an expression box

    current() is the node that you are currently located at - so, since your expression box is inside a repeating table (bound to a repeating node) - it is the current instance of the node. Here's a link to a blog post that explains it a bit better.

    Hilary Stoupa

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