Example: Changing a date format

This example illustrates how to use Activity Editor to change a source attribute's date format and assign the reformatted value to a destination attribute. In this example, the source attribute is QuoteSchedule.ExpireDate and the destination attribute is Invoice.PostingDate. The original date format is yyyyMMdd, and the updated date format is yyyy-MM-dd. This example assumes that the business objects and attributes have already been created and declared in the collaboration template scenario.

The following steps are required to change the source attribute's date format and then assign it to the destination attribute:

  1. Ensure that Activity Editor is open.
  2. Drag the QuoteSchedule.ExpireDate variable function block onto the editing canvas and drop it. (The function blocks that represent the business objects, attributes, and variables available in a scenario are located in the Variables folder of the Library and Content windows.)
  3. Drag and drop the Format Change function block onto the editing canvas to the right of the QuoteSchedule.ExpireDate function block, as shown in Figure 55.
    Figure 55. Placing the Format Change function block
    The figure shows the graphical view of the activity editor with both the quoteschedule.expiredate function block and the format change function block on the canvas.
  4. Place a connection link between the output port of the QuoteSchedule.ExpireDate function block and the Date input of the Format Change function block.
  5. Drag and drop the yyyyMMdd function block constant onto the editing canvas, placing it underneath the QuoteSchedule.ExpireDate and Format Change function blocks. This function block represents the current format of the QuoteSchedule.ExpireDate attribute.
  6. Place a connection link between the output port of the yyyyMMdd function block and the Input Format input of the Format Change function block, as shown in Figure 58.
    Figure 56. Specifying the input date format
    The figure shows the input format function block on the canvas and the connections between the quoteschedule.expiredate function block and date port on the format change function block. It also shows the connection between the yyyymmdd function block constant and the input format port on the format change function block.
  7. Drag and drop the yyyy-MM-dd function block constant onto the editing canvas, placing it near the yyyyMMdd function block. This function block represents the new format of the QuoteSchedule.ExpireDate attribute.
  8. Place a connection link between the output port of the yyyy-MM-dd function block and the Output Format input of the Format Change function block, as shown in Figure 58.
    Figure 57. Specifying the output date format
    The figure builds on the previous figure by adding a yy-mm-dd function block constant and its connection to the output format port on the format change function block.
  9. Drag and drop the Invoice.PostingDate function block to the editing canvas; this is the destination attribute. Place it to the right of the Format Change function block.
  10. To assign the output of the Format Change function block to the Invoice.PostingDate attribute, place a connection link between the Format Change function block output port and the Invoice.PostingDate input port as shown in Figure 58.
    Figure 58. Assigning output to the destination attribute
    The figure shows the addition of an invoicepostingdate function block with a connection that indicates the function block receives a formatted date from the format change function block.
  11. Save the activity definition by clicking File --> Save.

Copyright IBM Corp. 2004, 2005