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:
- Ensure that Activity Editor is open.
- 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.)
- 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
- Place a connection link between the output port of the QuoteSchedule.ExpireDate function
block and the Date input of the Format Change function block.
- 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.
- 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
- 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.
- 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
- 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.
- 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
- Save the activity definition by clicking File --> Save.
