Modifying How To Article Using Query Filter - InfoPath Dev
in

InfoPath Dev

Modifying How To Article Using Query Filter

Last post 07-07-2006 12:58 PM by Matt Faus. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 06-21-2006 06:38 AM

    Modifying How To Article Using Query Filter

    I would like to implement the technique described by Matt Faushttp://www.infopathdev.com/howto/tutorials/default.aspx?i=0bb37b4de44348408680a53a449f2353 for passing the ID from a selected record as a parameter but instead of using a Repeating Table to display the master list, I would like to use a DropDown list but I can not figure out how to do this. Could someone tell me how to change the following so that I can get the Job Number from a dropdown?
    var oQueryId = XDocument.DOM.selectSingleNode ( "/dfs:myFields/dfs:queryFields/q:JobMaster/@Job_Number" ); oQueryId.text = eventObj.Source.selectSingleNode("@Job_Number").text;
    XDocument.Query();
    XDocument.View.SwitchView("Detail");
    Dean
    Charlotte, NC
  • 06-21-2006 04:12 PM In reply to

    Re: Modifying How To Article Using Query Filter

    I think the easiest way to do this would be to make the value of the drop-down list the ID field.

    Double-click the drop-down list on the view and notice at the bottom there are two fields Display Name and Value. Set the display name to whatever you want the user to browse through and set the Value to be the ID that you will insert into the query. If you do this you won't have to change the code at all.

    I hope this helps!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-28-2006 07:39 AM In reply to

    Re: Modifying How To Article Using Query Filter

    Matt, thanks. My real problem is how to use a Drop down instead of a repeating table to display the "Master" records. What is the trick? I can not figure out how to prevent the dropdown from repeating.
    TIA
    Dean
    Charlotte, NC
  • 06-28-2006 08:20 AM In reply to

    Re: Modifying How To Article Using Query Filter

    In the Controls task pane, click drop-down box to place a new drop-down box on the view. Double-click this new drop-down and for Entries browse to the Master table. Click Ok until you are back onto the view. Click Preview.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-28-2006 09:42 AM In reply to

    Re: Modifying How To Article Using Query Filter

    When I do this, I get a message box stating " a drop down list box can not be bound to a group, repeating field, or a field with a picture....drop down must be inside a repeating table or repeating section that is bound to that group". what can i do to prevent this? I don't want to the drop down to repeat on the form.
    Dean
    Charlotte, NC
  • 06-28-2006 10:02 AM In reply to

    Re: Modifying How To Article Using Query Filter

    You have to create a single node either in your Main DOM or a secondary DOM to store the value of the DDL. Then just populate from the repeating group.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-07-2006 11:40 AM In reply to

    Re: Modifying How To Article Using Query Filter

    Matt, I've tried your suggestion and now i get an error from my script:
    Object Required, file: script.js, line 37.
    My function is as follows:
    function CTRL8_7::OnClick(eventObj)
    {
    var oQueryId = XDocument.DOM.selectSingleNode ( "/dfs:myFields/dfs:queryFields/q:Customers/@CustomerID" );
    oQueryId.text=eventObj.Source.selectSingleNode("@CustomerID").text;
    XDocument.Query();
    XDocument.View.SwitchView("Detail");

    }
    my Main DOM tree looks like
    myFields
    queryFields
    q:Customers
    dataFields
    d:Customers
    my:Customer
    The DDL is using the Master data connection with
    Entries =:/dfs:myFields/dfs:dataFields/d:Customers,
    value=@CustomerID and
    name=@ContactName

    Any suggestions on what I am doing wrong would be greatly appreciated.
    Dean
    Charlotte, NC
  • 07-07-2006 12:58 PM In reply to

    Re: Modifying How To Article Using Query Filter

    I think something is wrong with your XPath. You might want to check out the namespaces or do something to debug. Try running this modified code:

    function CTRL8_7::OnClick(eventObj)
    {
    var oQueryId = XDocument.DOM.selectSingleNode ( "/dfs:myFields/dfs:queryFields/q:Customers/@CustomerID" );

    XDocument.UI.Alert( "oQueryId object = " + oQueryId + " -- Null: " + (oQueryId == null) );

    oQueryId.text=eventObj.Source.selectSingleNode("@CustomerID").text;
    XDocument.Query();
    XDocument.View.SwitchView("Detail");
    }

    This should give you a little more information to help debug.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.