Change the Secondary Query - InfoPath Dev
in

InfoPath Dev

Change the Secondary Query

Last post 06-14-2007 07:57 AM by davidair. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-14-2007 07:37 AM

    Change the Secondary Query

    Whenever I run this code:


    function CTRL2_7::OnClick(eventObj)
    {
        //Retrieve the value of the field that you want to use as a parameter
        //to the stored procedure.
        var planIdValue = XDocument.DOM.selectSingleNode("/dfs:myFields/my:myPlanId").text;
        //Set the Command for the Query Adapter of the Data Source. Incorporate the
        //parameter values that you want to use.
        XDocument.QueryAdapter.Command = 'SELECT * FROM Ma_Plans WHERE PlanId = ' + planIdValue;
        //Query the Data Source.
        XDocument.Query();

        XDocument.QueryAdapters["Detail"].Command = 'SELECT * FROM vwMaPlanEquipmentDetail WHERE PlanId = ' + planIdValue;
        XDocument.QueryAdapters["Detail"].Query();
    }

     

    I get the following error on this line:

    XDocument.QueryAdapters["Detail"].Command = 'SELECT * FROM vwMaPlanEquipmentDetail WHERE PlanId = ' + planIdValue;

     

    XDocument.QueryAdapters.Detail is null or not an object

     

     

    Any ideas?

     Thanks
     

     

     

  • 06-14-2007 07:57 AM In reply to

    Re: Change the Secondary Query

    This happens because there is no QueryAdapters property...

    To access the main query adapter's command, use this:

    XDocument.QueryAdapter.Command

    To access a secondary adapter's command, use this:

    XDocument.DataObjects["Detail"].QueryAdapter.Command

    Hope this helps. Also using F1 while editing the code is very helpful, just hit F1 on XDocument to get more info about it.

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.