IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
  • 1.  xapp:select query dependencies

    Posted Thu April 17, 2003 04:58 PM

    X-Application Version: 4.1.1
    Tamino Version : 4.1.1
    Platform : Win2k
    WebContainer : Tomcat 4.1.1
    JDK Version : 1.4.1

    Is it possible to set up two xapp:select statement where the options of the second are dependent on the selection of the first?

    For example:
    In xapp:selectionA I have option1 and option2.
    If option1 is selected, I want the values of xapp:selectionB to be the values of Query1. If option2 is selected, I want the options to be the values of Query2.

    Can this be done? If so, how?

    Much thanks,
    Joel Patterson


    #API-Management
    #webMethods
    #Tamino


  • 2.  RE: xapp:select query dependencies

    Posted Thu April 17, 2003 06:54 PM

    Hi Joel,

    This is really a difficult and tricky question.
    I do not have a quick solution at present.

    An idea would be to encapsulate each select tag in to one seperate HTML form.
    Wenn the first select tag is used a javascript code should submit this form with the current page as target.
    Now, when the page is reinvoked the result value of the first select tag can be used in the
    second select tag.
    Understand?

    <form …>
    <xapp:select …>
    …</select
    </xapp:select>


    There is still one pitfall. When calling the page the first time the variable firstSelect
    is still not defined. I suppose you need to check this with a pure java snippet in your JavaServer Page
    befor the second xapp:select gets processed(). If the variable isn’t defined then set it to a default value.

    I hope this will help you at the moment. My colleques might have an idea(I can’t promise) when they
    are back after our German National Holidays.

    OK, sorry that I do not have a detailed solution.

    Bye and nice holidays

    Thorsten


    #webMethods
    #API-Management
    #Tamino


  • 3.  RE: xapp:select query dependencies

    Posted Thu April 17, 2003 07:38 PM

    X-Application Version: 4.1.1
    Tamino Version : 4.1.1
    Platform : Win2k
    WebContainer : Tomcat 4.1.1
    JDK Version : 1.4.1

    Hi Thorsten,
    following is an example of the situation that Joel was describing above.
    I have attached the schemas (FOMType.tsd, TypeValues.tsd) that are at play in this situation along with some test data for TypeValues, allong with the full jsp page where following code snipped is taken from.
    Could you please suggest how i would solve this problem ?

    Thanks…

    –joeycz

    <xapp:loop document=“FOMTypeDocument” select=“/FOMType/units” iterate=“unit” targetbase=“loop0”>









     

    <xapp:setvar name=“unitType_query” scope=“session”>
    for $x in input()/TypeValues[@type_name=‘unit’]
    return $x/@value_type
    </xapp:setvar>

    <xapp:select collection=“NMP” text=“${unitType_query$}”>

    </xapp:select>

    <xapp:directelementaction type=“setValue” select=“./@type” arg=“”/>

    <xapp:edit select=“.”>
    <xapp:setvar name=“unitTypeValues_query” scope=“session”>
    for $x in input()/TypeValues[@type_name=‘unit’ and @value_type=‘’]
    return $x/value
    </xapp:setvar>

    <xapp:select collection=“NMP” text=“${unitTypeValues_query$}”>
    <select name=“VAL__<xapp:display select=”$POS"/>">

    </xapp:select>
    </xapp:edit>



    </xapp:loop>
    files.zip (5.22 KB)


    #Tamino
    #API-Management
    #webMethods


  • 4.  RE: xapp:select query dependencies

    Posted Tue April 22, 2003 12:22 PM

    Hi Joey,

    sorry that it takes so long for the response,
    but we had easter holidays.

    I had a look on your page and I tried to run the page on my machine, but it does not work, because of the environment of the page.

    Is it possible to you to send me the application as a war file?

    If you do not want make you application public over the community you are able to sent my the application straight by mail.

    Bye
    Thorsten


    #webMethods
    #API-Management
    #Tamino


  • 5.  RE: xapp:select query dependencies

    Posted Fri April 25, 2003 01:31 PM

    Hi Joey,

    thank you for sending the application.

    I have used the idea I mentioned before. Let me show you the modified extract of you page:

    ...
    //your first defined query and the corresponding select tag
    <xapp:setvar name="unitType_query" scope="session">
    for $x in input()/TypeValues[@type_name='unit'] 
    return $x/@value_type  
    </xapp:setvar>
    //I'll store the result of the select tag straight into the destionation attribute:
    <xapp:edit select="./@type">
    <xapp:select collection="${NMPCollection$}" text="${unitType_query$}">
    //the javascript forces to reload the page after changing the state
    <select  onChange="javascript:document.forms['form_create'].action='create.jsp';
    document.forms['form_create'].submit();">
    <option value=""></option>
    </select> 
    </xapp:select>
    </xapp:edit>
    ...
    //The second xapp:select will be displayed, when the a value is selected in the first select tag
    <xapp:if condition="notempty" select="./@type" document="FOMTypeDocument" base="loop0" >
    <xapp:setvar name="unitTypeValues_query" scope="session">
    for $x in input()/TypeValues[@type_name='unit' and @value_type='
    <xapp:display select="./@type"/>'] return $x/value  
    </xapp:setvar>
    <xapp:edit select=".">
    <xapp:select collection="${NMPCollection$}" text="${unitTypeValues_query$}">
    <select name="VAL_selected-from-VAL-value_type-checkbox_<xapp:display select="$POS"/>">
    </select> 
    </xapp:select>
    </xapp:edit>
    </xapp:if>



    With this modifications on your page it works fine.

    Bye
    Thorsten

    [This message was edited by Thorsten Raab on 25 Apr 2003 at 12:32.]


    #webMethods
    #Tamino
    #API-Management


  • 6.  RE: xapp:select query dependencies

    Posted Fri April 25, 2003 05:38 PM

    Thanks very much Thorsten!

    Awsome! Works great… !

    –joeycz


    #webMethods
    #API-Management
    #Tamino