Populate expressionbox based on other control - InfoPath Dev
in

InfoPath Dev

Populate expressionbox based on other control

Last post 03-06-2007 10:47 PM by nukkumatti. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 03-06-2007 12:30 AM

    Populate expressionbox based on other control

    I' am trying to full in the article price based on a selected article name. I've added an expressionbox with the formula:
    xdXDocument:GetDOM("LOCALSALES_ARTICLES")/dfs:myFields/dfs:dataFields/d:LOCALSALES_ARTICLES/@UnitPrice[@ArticleID = 4]

    I came up to that solution by reading
    http://blogs.msdn.com/infopath/archive/2004/09/13/228881.aspx

    If I don't fill in a criterium (leave out [@ArticleID = 4]), I get the first record, so I think my source is OK.

    Can anyone tell me what I am doing wrong?


    Kind Regards,
    Hans (struggling with my first infopath form)

    I am using infopath 2003
    Hans.
    Infopath 2003 / Jscript
  • 03-06-2007 12:41 AM In reply to

    Re: Populate expressionbox based on other control

    HI Hans,

    I think you have to use the current() function.

    See below example, In my case I use a webservice to populate the values of a drop down list. When the user selects a name from this ddl the mail address is written into another text box. I use this statement within a rule of the ddl but your exbox should work as well.

    xdXDocument:GetDOM("Designer")/dfs:myFields/dfs:dataFields/tns:getDesignersResponse/tns:getDesignersResult/tns:Credentials[tns:Account = current()]/tns:Mail

    Does this help ?
    Listen to Motörhead cos they play Rock'n Roll :)
  • 03-06-2007 12:49 AM In reply to

    Re: Populate expressionbox based on other control

    Thanks for your time.
    I've changed the Xpath formula to
    xdXDocument:GetDOM("LOCALSALES_ARTICLES")/dfs:myFields/dfs:dataFields/d:LOCALSALES_ARTICLES/@UnitPrice[@ArticleID = current()]

    But still the expressionbox isn't filled in.

    Hans.
    Infopath 2003 / Jscript
  • 03-06-2007 12:54 AM In reply to

    Re: Populate expressionbox based on other control

    try [@ArticleID = current()]/@UnitPrice at the end
    Listen to Motörhead cos they play Rock'n Roll :)
  • 03-06-2007 01:03 AM In reply to

    Re: Populate expressionbox based on other control

    xdXDocument:GetDOM("LOCALSALES_ARTICLES")/dfs:myFields/dfs:dataFields/d:LOCALSALES_ARTICLES/@Unitprice[@ArticleID = current()]/@UnitPrice

    Gives no result in expression box.
    I don't know if this is of any importance but the localsales_articles is a secondary data source to pick the correct article to order.
    Hans.
    Infopath 2003 / Jscript
  • 03-06-2007 01:47 AM In reply to

    Re: Populate expressionbox based on other control

    Can you post your secondary data source? I guess it's an xml file right ?
    Listen to Motörhead cos they play Rock'n Roll :)
  • 03-06-2007 03:24 AM In reply to

    Re: Populate expressionbox based on other control

    No,
    It's a SQL datasource. In the meanwhile, i experimented with the 'HOW TO' of Greg Collins http://www.infopathdev.com/howto/tutorials/default.aspx?i=9111ef580f95479890fc18fb2c5bac85)
    But once again, I cannot alter it so it works against a SQL table iso a XML datafile.

    Thanks again for your time!
    Hans.
    Infopath 2003 / Jscript
  • 03-06-2007 05:12 AM In reply to

    Re: Populate expressionbox based on other control

    This should work for you, use this within a rule of your dropdown list and you can fill a textbox with your unit price

    xdXDocument:GetDOM("LocalSales_Articles")/dfs:myFields/dfs:dataFields/d:LocalSales_Articles/@Expr2[../@Expr1 = current()/../my:yourDDL]
    Listen to Motörhead cos they play Rock'n Roll :)
  • 03-06-2007 07:08 AM In reply to

    Re: Populate expressionbox based on other control

    Since this is the newbie section:
    Can you please tell me how i can find the value of "/my:yourDLL"?

    I haven't got a clue!
    Hans.
    Infopath 2003 / Jscript
  • 03-06-2007 10:47 PM In reply to

    Re: Populate expressionbox based on other control

    I Good Nights Rest did the job for me, I've modified the rule to:
    xdXDocument:GetDOM("LOCALSALES_ARTICLES")/dfs:myFields/dfs:dataFields/d:LOCALSALES_ARTICLES/@UnitPrice[../@ArticleID = current()]
    Now the texbox gets populated.

    Thanks a million, Jerome.
    Without your help I never would have found the solution.
    Hans.
    Infopath 2003 / Jscript
  • 03-06-2007 10:47 PM In reply to

    Re: Populate expressionbox based on other control

    Oh sorry, it's not a value its the name of your Drop Down List control from where you select your article, may be my:field1 ?
    Listen to Motörhead cos they play Rock'n Roll :)
Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.