Adding a Constraint With Multiple Conditions

In Creating a Conditional Constraint Using the Constraints Tab, a constraint was added to the join that specifies if the widgetId of the availRequest element is equal to the widgetId of the priceRequest element the merged repeating element quoteResponse be returned. Creating a constraint using the Where Clause Expression pane of the Constraints tab adds a where clause to the XQuery for loops which limits the target repeating elements which are returned during run time. During run time, the for loop will iterate only over those repeating elements that meet the complex condition.. In this section you add another condition (resulting in a complex condition) to the where of the for loop to further limit what is returned by the for loop as shown in the figure.

Figure : Complex Constraint

image

To Add a Condition to the Join in the Data Transformation Tutorial

  1. From the BEA WebLogic Workshop menu bar, choose File —> New —> Application....
  2. The New Application dialog box is displayed.

  3. In the left pane, select the Tutorial folder.
  4. In the right pane, select Tutorial: Process Application.
  5. In the Name field, enter Tutorial_Add_Condition.
  6. From the Server drop-down menu, select the integration server. For example, if you installed WebLogic Platform in the c:\bea directory on Windows, the path to the integration server is:
  7. c:\bea\weblogic81\samples\domains\integration 
    
  8. Click Create.
  9. Your Tutorial Process application is created and displayed in the Application tab.

  10. In the Application tab, expand the Tutorial_Add_ConditionWeb folder.
  11. The directories and files that make up the Tutorial project are displayed.

  12. In the Application tab, expand the Tutorial_Add_ConditionWeb/requestquote folder.
  13. The DTF, XQ, and JPD files used in the tutorial are displayed. These files are part of the Tutorial project.

  14. View Join.xq in the Design View. In the Application tab, double-click Tutorial_Process_Application\Tutorial_Add_ConditionWeb\requestquote\TutorialJoin.dtf\Join.xq and select the Design View tab.
  15. Select the link between the availQuoteDoc\availRequest node and the quote\quoteResponse node in the Target pane.
  16. The single condition that makes up the where clause is displayed in Where Clause Expression pane of the Constraints tab.

  17. Create the second condition in the where clause:
    1. In the Source pane select the availQuoteDoc/availRequest/requestedQuanity node and drag-and-drop it into the Left Hand Expression section of the Where Clause Expression pane.
    2. Select the < operator.
    3. Remove the text in the Right Hand Expression section of the Where Clause Expression pane.
    4. In the Right Hand Expression section of the Where Clause Expression pane enter 50.
    5. From the Join Type field select the AND option.
    6. The Join Type determines how the conditions that make up where clause are evaluated during run time.

    7. Click Add.
    8. The second condition is added to the where clause of the for loop.

  18. To run the query, select the Test View of the XQ file.
  19. In this step, you import AvailQuote.xml for the source parameter: $availQuoteDoc:
    1. From the drop-down menu in the Source Data pane, select $availQuoteDoc.
    2. Click Import... .
    3. The Open XML File to Test dialog box is displayed.

    4. Double-click the requestquote folder.
    5. Double-click the testxml folder.
    6. Double-click the AvailQuote.xml file.
  20. In this step, you import PriceQuote.xml for the source parameter: $priceQuoteDoc:
    1. From the drop-down menu in the Source Data pane, select $priceQuoteDoc.
    2. Click Import... .
    3. The Open XML File to Test dialog box is displayed.

    4. Double-click the requestquote folder.
    5. Double-click the testxml folder.
    6. Double-click the PriceQuote.xml file.
  21. Enter the taxRate value:
    1. From the drop-down menu in the Source Data pane, select $taxRate.
    2. In the Node Value field of the $taxRate node, double-click on the existing value, and enter: 0.08 and click Enter.
  22. In the Result Data pane, click Test.
  23. If not currently running, the WebLogic Server for the current application will be started. In order for a query to run, the WebLogic Server for the current application must be running.

    In the Result Data pane, a graphical representation of the target data is displayed. The XML result for this example is also displayed in Figure: Complex Constraint.

    During run time, the where clause limits what is returned by the for loop. If the two widgetIds are equal and the requestedQuanity is less than 50, the quoteResponse element is returned.

Previous Document Next Document