Main datasource and different queries - InfoPath Dev
in

InfoPath Dev

Main datasource and different queries

Last post 11-12-2004 01:48 AM by jonbrave. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-10-2004 10:54 AM

    • jonbrave
    • Top 200 Contributor
    • Joined on 10-15-2004
    • United Kingdom
    • Posts 59

    Main datasource and different queries

    How (if at all) can I accomplish the following:

    My Main datasource is attached to a webservice/dataset; I get "queryFields" & "dataFields". I have a "standard" query which fills dataFields. I have a "submit" which later sends changed "dataFields" back.

    Now, I want to have an "alternate" query, with different queryFields, attached to a different webservice (i.e. the webservice name is different and so are its (input) parameters). BUT the response it gets back (output) is the same stuff as my existing query and I need its output to go into the same dataFields (to which all the controls are bound), ready for update and submit.

    A simple example: suppose there are two webservices for returning the same data (say, a row). One, "Get", takes a parameter of what record to get; another, "Find", takes quite different, multiple parameters to do with how to find one record, which it then returns.

    I don't mind how I achieve this (scripting fine), but I can't find a way. I could play with WebServiceAdapters' OutputLocation/Input, the main QueryAdapter, secondary Adapters... I have tried adjusting the QueryAdapter to change what it calls/passes the WS (so as to preserve the OutputLocation), and adjusting a secondary DataAdapter to change its OutputLocation (so as to preserve what it calls/passes to the WS), but always get errors. I think there are problems with namespaces/names: both queryFields & dataFields contain names based on the name of the webservice and that causes problems when trying to mix them, I believe...

    The only possibility I see at the moment is to somehow wrap up the underlying webservices in a single "container" webservice so that I have just the one WS which accepts all the parameters for all the underlying webservices it might call, looks at them, and decides what to actually call (they all return the same result stuff). But that seems pretty ugly...

    What can be done?
  • 11-11-2004 06:11 AM In reply to

    Re: Main datasource and different queries

    This sounds eerily similar to my issue

    http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=71

    I basically had to rethink my process. Instead of having the first Dropdownlist(DDL1) call the second Dropdownlist(DDL2) which in turn returned the datafields, I combined the contents of DDL1 and DDL2 into one DDL and called the datafields.


    Hope this helps.... yours seems a tad more complex.
  • 11-11-2004 08:19 AM In reply to

    • jonbrave
    • Top 200 Contributor
    • Joined on 10-15-2004
    • United Kingdom
    • Posts 59

    Re: Main datasource and different queries

    Unfortunately, I don't think so.

    Most of my issues stem from the fact that I need to use two differently named webservices; hence different adapters; hence different structure in queryFields/dataFields, since these include the name of the webservice in their structure (that's the only difference between them, at least in the returned dataFields). Then any attempt to use/populate the other adapter from one adapter (e.g. I'd like queryAdapter2's output to go into queryAdapter1's dataFields) leads to disaster.

    Hasn't anyone else had this issue?

    (Greg, where are you? :) )
  • 11-11-2004 10:54 AM In reply to

    Re: Main datasource and different queries

    Sorry. I try to get to these questions, but my time is drawn between many thing, including fulltime work.

    Since your datafields are essentially identical, except for maybe a root node or two, what you can do is the following. Let's assume your common root node is named s0:MyData.

    var oMyData1 = XDocument.DOM.selectSingleNode("//s0:MyData");
    var oMyData2 = XDocument.GetDOM("WS2").selectSingleNode("//s0:MyData").cloneNode(true);
    oMyData1.parentNode.replaceChild(oMyData2, oMyData1);

    This makes a copy of the second WS data fields and dumps them into the main DOM, replacing the previous data.

    Greg Collins [InfoPath MVP]
  • 11-12-2004 01:48 AM In reply to

    • jonbrave
    • Top 200 Contributor
    • Joined on 10-15-2004
    • United Kingdom
    • Posts 59

    Re: Main datasource and different queries

    quote:
    Originally posted by Greg Collins

    Sorry. I try to get to these questions, but my time is drawn between many thing, including fulltime work.



    Then you shouldn't have any time to be having babies :)

    Thanks for your thought. It's stuff like "cloneNode" & "replaceNode" that I didn't know about (I don't normally do yucky script!).

    Strangely, when I looked at the DOMs I saw some differences I didn't understand in structure between Main & Secondary adapter results, given they're returning the same stuff from the WS. I'll have to look into this further if I want to implement, but at least I understand what approach you're suggesting.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.