# Combine Price and Availability Quotes

Complete the following tasks:

- To Create an Instance of the TutorialJoin Control in Your Project
- To Design the Process Interaction With the TutorialJoin Control

To Create an Instance of the TutorialJoin Control in Your Project

The TutorialJoin.dtf control is provided in your tutorial application. It is available in the requestquote folder in your Tutorial_Process_ApplicationWeb project folder. To learn how to build the TutorialJoin.dtf control, see Tutorial: Building Your First Data Tansformation.

Complete the following steps to add an instance of this control to your business process.

1. If the Data Palette is not visible in WebLogic Workshop, choose View —> Windows —> Data Palette from the menu bar.
2. On the Applications pane, click the TutorialJoin.dtf file.

3. Drag the TutorialJoin.dtf file from the Applications pane onto the Data Palette. The instance of your control (tutorialJoin) is created and displayed in the Data Palette as shown in the following figure:

To Design the Process Interaction With the TutorialJoin Control

In this step, you design the business process to call the following method on the tutorialJoin control:

    join(PriceQuoteDocument _priceQuoteDoc,
    AvailQuoteDocument _availQuoteDoc, float taxRate)

This join method does the work of combining the data returned to your business process from different systems and creating a single XML response document (quote), which is subsequently returned to the business process' client.

1. Expand the tutorialJoin control instance in the Data Palette, then click the following method:

    QuoteDocument join(org.example.price.PriceQuoteDocument _priceQuoteDoc,
    org.example.avail.AvailQuoteDocument _availQuoteDoc,float taxRate)

2. In the Design View, drag the method from the Data Palette and drop it on your RequestQuote business process placing it immediately after the Convert AvailList to AvailQuote XML node.
3. Rename the node from join to Combine Price and Avail Quotes.

4. Double-click the Combine Price and Avail Quotes node. The node builder opens on the General Settings tab.
5. Confirm that tutorialJoin is displayed in the Control field, and that the following method, which you dragged onto the node from the Data Palette, is selected in the Method field:

    QuoteDocument join(org.exampel.price.PriceQuoteDocument _priceQuoteDoc,
    org.example.avail.AvailQuoteDocument _availQuoteDoc,float taxRate

6. Click Send Data to open the second tab in the node builder.

The Control Expects field is populated with the data type expected by the join method on the tutorialJoin control, as shown in the following figure:

7. Under Select variables to assign, select the variables such that their data types match the data type expected (Control Expects) in the input parameters to the join() method, as follows:

- For PriceQuoteDocument select priceQuote (PriceQuote).

priceQuote holds the price quote data, which is returned from the priceProcessor service in the For Each loop in your business process.

- For AvailQuoteDocument, select availQuote (AvailQuote).

availQuote holds the availability quote data, which is returned from the availProcessor service in the For Each loop in your business process.

- For float taxRate, select taxRate (float).

taxRate holds the rate of sales tax applied to the quote, based on the shipping address, which is returned to your business process from the taxCalculation service.

8. Click Receive Data to open the third tab in the node builder.

On the Receive Data tab, the Control Returns field is populated with QuoteDocument, which is the data type returned by the join() method.

9. Click the arrow in Select variable to assign, then choose Create new variable.... The Create Variable dialog box is displayed.

10. In the Variable Name field, enter Quote.
11. In the Select Variable Type field, select quote from the list of XML types, as shown in the following figure:

The Variable Type field is populated with org.example.quote.QuoteDocument.

12. Click OK to create the new variable. The Quote variable is displayed in the Receive Data tab, and also in the XML list in the Data Palette.
13. To close the node builder, click the X in top right-hand corner.

This step completes the design of the Combine Price and Avail Quotes node. At run time, the availability quote data in XML format is assigned to the Quote variable.

14. From the Workshop menu, select File —> Save All.

To complete Part III of the tutorial, it only remains to write the quote to your file system (an optional step), and to create the Client Response node in your business process. The business process returns the quote you created to the client via the Client Response node.

Step 10: Write Quote to File System

Step 11: Send Quote From Business Process to Client

Related Topics

To learn how to create Transformation controls, and specifically to learn how to design the TutorialJoin.dtf control used in this section, see Tutorial: Building Your First Data Tansformation.