Repeating Table with Dynamic Query - InfoPath Dev
in

InfoPath Dev

Repeating Table with Dynamic Query

Last post 07-08-2005 08:21 PM by Greg Collins. 15 replies.
Page 1 of 2 (16 items) 1 2 Next >
Sort Posts: Previous Next
  • 07-01-2005 04:56 PM

    Repeating Table with Dynamic Query

    I have a repeating table with 3 dropdown boxes.
    1st Dropdown dataconnection to xml file.
    2nt Dropdown cascade to the first, with XSL modifications , xd:preserve, and OnAfterchange to call a webservice with the queryvalue set by the value of the dropdown.

    3rd Dropdown dataconnection to the webservice results., therefore, the results change each time the 2nd dropdown is changed.

    So, upon first dropdown , the second dropdown values change according to the selection .
    and ipon the 2nd dropdown , the values of the 3rd dropdown come from the webservice results.

    The problem with the scenario is that on insert of any future rows in the table , and invoking the 2nd dropdown , the webservice results, rewrites all the results. ?
    How do I keep the 3rd drop down to map to the query but keep its results separate. ?


  • 07-03-2005 12:45 AM In reply to

    Re: Repeating Table with Dynamic Query

    Hi Richard,
    I think this is the same as a similar problem. You need to restrict the filter to the specific row. I believe there is a post on the Microsoft blog that talks about this. It will require a tricky xpath in your filter, but it is possible. Good luck researching further.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-05-2005 07:20 PM In reply to

    Re: Repeating Table with Dynamic Query

    I was not able to find any post there, however, it seems that one could have an intermediate field where the webservice maps to.

    then , Onafterchange event on the 2nd dropdown:

    1- call the query , wait for the data to be there in the intermediate field,
    2- take the data from the intermediate field and populate the dropdown .


  • 07-06-2005 01:07 AM In reply to

    Re: Repeating Table with Dynamic Query

    It's easier to do than that. I'll ask someone else to send the link.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-06-2005 11:27 AM In reply to

    Re: Repeating Table with Dynamic Query

    Hi Richard,

    Map the third dropdown two a secondary xml with the structure similar to the following one
    <Dorpdown3Values>
    <Node dropdown2value="dd2v1">
    < Dorpdown3Value>value1</ Dorpdown3Value>
    < Dorpdown3Value>value2</ Dorpdown3Value>
    </Node>
    <Node dropdown2value="dd2v2">
    < Dorpdown3Value>value1</ Dorpdown3Value>
    < Dorpdown3Value>value2</ Dorpdown3Value>
    </Node>
    </Dorpdown3Value>

    a. You will create a “<Node>” for each dropdown2
    b. You will fill in Dropdown3Values when you select dropdown2 value(When the webservice is called)
    c. Bind Dropdown3 to this new xml and filter “< Dorpdown3Value>”
    based on the dropdown2Value “<Node dropdown2value="dd2v2"> value.

    So now
    1. When you change a value in dropdown2, OnAfterchange for dropdown2 gets fired.
    2. In OnAfterChangeEvent call the webservice.
    3. Fill the data into the above xml.
    4. You should be able to see the values in the dropdown.


    Agni
    InfoPathDev India
  • 07-06-2005 07:11 PM In reply to

    Re: Repeating Table with Dynamic Query

    Hi , Thanks for your response..

    Your solution suggests that I have to populate the secondary xml ( i suppose that is a datasource with no controls in the page or is it an xml file ? please confirm.) How do i do that.??


    I was not planning to have the web service to return all the values of dropdown 3 for each values of dropdown2.. !!
    because that may become slow,
    I want to call the webservice only for the selected dropdown2 value.!
    Unless you suggest that this works anyway ??



  • 07-06-2005 10:26 PM In reply to

    Re: Repeating Table with Dynamic Query

    Hi Richard,
    What's with all of the !! and ?? marks? Did you just drink a slurpee or something from 7-11? :)

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-07-2005 08:35 AM In reply to

    Re: Repeating Table with Dynamic Query

    Hi Patrick,

    I run on tea and coffee.. and googling .. !!


    quote:
    Originally posted by Patrick Halstead

    Hi Richard,
    What's with all of the !! and ?? marks? Did you just drink a slurpee or something from 7-11? :)

    Patrick Halstead [InfoPath MVP]
    InfoPathDev

  • 07-07-2005 12:36 PM In reply to

    Re: Repeating Table with Dynamic Query

    Hi Richard,
    Me too !!! :) Anyway, Googling is great. Almost rhymes with Ogling. Makes you wonder if they weren't thinking the answer to MS's question: where do you want to go today? Was: Go Ogle. Not sure in what context though.

    Anyway, to get to your question: you can change your Web service to return only a set number of values or filter them in the dropdown.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-07-2005 07:37 PM In reply to

    Re: Repeating Table with Dynamic Query

    I modified the return of the web service to include a field whose attribute will be the same as the query parameter . i.e
    something like this:

    - <result>
    - <option name="dropdown2name">
    <subresult>John Smith the 4th</subresult>
    <subresult>Ellen Ross</subresult>
    <subresult>John Smith the 1th</subresult>
    </option>
    </result>

    and I set the entry of the dropdown3 with filter as:


    /dfs:myFields/dfs:dataFields/tns:QueryResponse/tns:QueryResult/result/option/subresult[../@name = xdXDocument:get-DOM()/my:myFields/my:Choices/my:Choice/my:OptionName]


    Here is portion of the code for the DropDown2 After change :

    IXMLDOMNode fieldValue1 = thisXDocument.DOM.selectSingleNode("/my:myFields//my:OptionName");
    IXMLDOMNode queryValue1 = wsDOM.selectSingleNode("//dfs:myFields/dfs:queryFields/tns:DistinctQuery/tns:st1");
    queryValue1.text = fieldValue1.text;
    DataObject objDO = null;
    objDO = thisXDocument.DataObjects["DistinctQuery"];
    objDO.Query();

    The first row in the table works well and the dropdown3 gets changed for each change in dropdown2.
    However, once you add the second row in the table,, and select a different dropdown2, the results of dropdown3 is the same as the values for the dropdown3 in the first row..?

    using the debugger, I saw that fieldvalue1.text is not that of current row but belongs to the first row. ??

  • 07-07-2005 11:17 PM In reply to

    Re: Repeating Table with Dynamic Query

    Hi again,
    I think this is an xpath issue with your filter. You need to refer to the correct row in the DOM to get the filtering to reflect the current sibling. There are numerous posts on this issue for tables. I'll ask Agni if he has time to look up the xpath incantation.
    Regards,

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-08-2005 12:49 PM In reply to

    Re: Repeating Table with Dynamic Query

    See if the following helps:
    http://www.infopathdev.com/howto/tutorials/default.aspx?i=51dce616335a4ff6a78f2d289baf4651

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 07-08-2005 03:31 PM In reply to

    Re: Repeating Table with Dynamic Query

    Hi Greg,

    I am trying to filter the dropdown3 for the current row in the table:

    /dfs:myFields/dfs:dataFields/tns:MarkLogicDistinctQueryResponse/tns:MarkLogicDistinctQueryResult/result/option/subresult[../@name = xdXDocument:get-DOM()/my:myFields/my:Choices/my:Choice[number(count(preceding-sibling::node()) + 1) ]/my:OptionName]

    but that did not work , and neither did this:

    ../@name = current()[number(count(preceding-sibling::node()) + 1)]/my:OptionName

  • 07-08-2005 03:56 PM In reply to

    Re: Repeating Table with Dynamic Query

    Hi Richard.

    Sorry. I jumped into your discussion at the end when I posted my response. I just went back and read your scenario. I believe that you have a much more difficult situation here.

    (following, dd will stand for 'drop-down'):

    The problem is that when you refresh the web service with the dd2 selection, you are refreshing it for ALL dd3's. That means than the selections from any previous dd3 have been updated to the selections on your current row. This is a problem. That means if you have 5 rows, and on the 5th row you make a selection in dd2, the web service is updated and dd3 is populated. But then go back to dd3 on rows 1-4 and you'll find the same list for all 5 rows. Whoops!

    This, unfortunately, is a restricting design flaw. The only way around it is to redesign.

    Here's what I recommend (but don't know that it's possible because I don't know how the backend of you web service works):

    If possible, dd3 should be bound to a secondary data source (can be web service still if you want) that pulls down ALL the related data to any possible selection in dd2. That means if dd2 can be A, B or C, then dd3 needs to be able to pull A {1, 2, 3}, B {4, 5, 6}, or C {7, 8, 9}. I.E. dd3 will populate with 4, 5 and 6 if dd2 is B.

    The dd3 data cannot keep changing like it currently is. There has to be static data on the back end with some kind of a link to tie dd2 and dd3 together. Thus the dd3 data might be flat and look something like this (two columsn per row):
    A, 1
    A, 2
    A, 3
    B, 4
    B, 5
    B, 6
    C, 7
    C, 8
    C, 9

    Or it might be hierarchical and look simthing like:
    A
    1
    2
    3
    B
    4
    5
    6
    C
    7
    8
    9

    But it must have values representing those in dd2 as well as the choices for dd3 that tie to the dd2 values.

    The big switch here (and I don't know that you can do this -- it won't be so nice if you have something like 100,000 rows or something) is that you have to have a static data source to work with for DD3, not dynamic like it is now.

    This would be entirely different if the cascading list was NOT in a repeating table. Then you wouldn't have this problem.

    Good luck!

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 07-08-2005 04:33 PM In reply to

    Re: Repeating Table with Dynamic Query

    Hi Greg,

    I filtered the dd3 using
    ../@name = current()/../my:Choice[position()]/my:OptionName
    and that did the part of the trick.
    i.e , even though that the web service re-populates the dd3's in all rows, however, I am still able to see the selected values of dd3 ( i.e the text does not change .)

    So, I figured, that if the user wants to re-select his dd3 in any of the rows, all I have to do is another query .. ! Ha..
    But, I do not have access to the DropDown_onClick () ???
    I tried the OnBeforeChange, but , I am not able DOM is read only ?

    Any tricks here ?

Page 1 of 2 (16 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.