Information Lookup Ex, Query results display - InfoPath Dev
in

InfoPath Dev

Information Lookup Ex, Query results display

Last post 02-01-2006 04:02 PM by lxhiss. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 12-21-2005 09:48 PM

    • lxhiss
    • Not Ranked
    • Joined on 12-11-2005
    • Posts 9

    Information Lookup Ex, Query results display

    I'm attempting to replicate the functionality of the Information Lookup example in the Infopath 2003 SDK but having a few issues.

    I have no problem displaying a list of names in a drop down box but on selecting the name how do I get it to copy values back onto the form. I'm connecting to a SQL database

    I'm attempting to copy the function msoxd__method::OnAfterChange(eventObj. But I don't understand where to define the function and what the msoxd__method means/cames from in the example. How do I put code into an on change event for a particular field.

    The function I'm assuming I need to replicate from the sample is

    function msoxd__method::OnAfterChange(eventObj)
    {
    if ((eventObj.IsUndoRedo) || (eventObj.Operation == "Delete"))
    return;

    var objShippingCompanyNode = null;
    var objCompanyNode = null;

    // Get the current shipping company name
    objShippingCompanyNode = XDocument.DOM.selectSingleNode("/liSample/shipping/company");

    if (objShippingCompanyNode.text)
    {
    // Search in the secondary data source for a shipping company with
    // this name that delivers via the newly selected method
    objCompanyNode = XDocument.GetDOM("Shipping Companies").selectSingleNode("/shippingCompanyList/"
    + "company[@name='" + objShippingCompanyNode.text + "' and @method='" + eventObj.NewValue + "']");

    // If no company node was found, clear the company field because
    // because it must not be a valid entry in the dropdown list
    // for the new shipping method.
    if (!objCompanyNode)
    objShippingCompanyNode.text = "";
    }
    }

    Any help would be much appreciated.

    Cheers

    Lucian
  • 12-28-2005 10:30 PM In reply to

    Re: Information Lookup Ex, Query results display

    Hi Lucian and welcome,
    In the InfoPath Designer, go to the taskpane and select the secondary data source that you are retrieving information from. Right click on the field that holds the value of the data downloaded from your SQL database. Choose Properties. Select Rules tab. Click Add. Click Add Action. Select "Set a Field's Value". Click the icon next to the Field and select hte field to set from the main data source. Click on the fX button and insert a field. Choose the default (same as the secondary data source field). Click OK until you escape from dialog box hell. Preview the form.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 12-29-2005 09:47 AM In reply to

    Re: Information Lookup Ex, Query results display

    If you want the OnAfterChange function in code then here are steps to follow

    To Add an OnAfterChange event
    1. Right click on the control and click on Show Data source
    2. Double click on the node selected in the Data source task pane
    3. In the window that opens click on Validations and Event handler tab
    4. In the Event Handlers dropdown select the OnAfterChange event and click on edit

    This will create the neccesary entries and open the OnAfterChange event in code for that node.

    Shanthi
    InfoPath Dev India
    Shanthi Reddy
  • 02-01-2006 04:02 PM In reply to

    • lxhiss
    • Not Ranked
    • Joined on 12-11-2005
    • Posts 9

    Re: Information Lookup Ex, Query results display

    Guys thanks for your responses. I didn't end up getting that onchange event to work. I did however manage to use the new from Data Connection Wizard and click a button to retrieve data into the appropriate fields. I ended up having to publish a new library for the forms. Thank you all the same
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.