PhixFlow Help

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Current »

By the end of this chapter you will be able to:

  • Use the attribute function replaceAll()
  • Use the attribute function toUpper()
  • Use the attribute function substring()
  • Use the attribute function if()
  • Use the internal variable _out

Reformat post codes to remove all spaces and make upper case

You will reformat post codes to remove all spaces, and ensure that all letters are upper case:

  1. In your model, add a new stream:
    1. Hover over Customer Details with Region, and press  Add a new Stream
    2. Give the new Stream the Name: Reformatted Customer Details
    3. Drag all attributes from Customer Details with Region to the new stream
  2. Open the configuration form for Reformatted Customer Details
    1. In the Attributes section, add a new attribute:
      • Press 
      • In the attribute details form that pops up:
      • Set the Name: ReformattedPostCode
      • Leave the settings for the attribute as default (Type is String, Length is 50)
      • Set the Attribute Expression to
toUpper(replaceAll(in.PostCode, " ", ""))
    • Press

In the repository browser find  Attribute Functions. All attribute functions available in PhixFlow are shown. Find the attribute functions you used above – toUpper() and replaceAll() – and double-click each of these to see the help pages for these functions.

Generate short code for Counties

Now you will generate a short code for counties by taking the first 3 letters of the county for each customer detail record:

  1. Add a new attribute called CountyShortCode
  2. Leave the default settings
  3. Set the attribute expression to
substring(in.County, 1, 3)
  • Press 

Categorise bills as "LARGE" or "NORMAL"

Categorise bills as "LARGE" or "NORMAL":

  1. Add a new attribute called BillCategory
  2. Leave the default settings
  3. Start the attribute expression to:

    if (in.BILLAMOUNT > 10.0, "LARGE", "NORMAL")
  4. Press 

Set special processing flag

Finally, you will now set a special processing flag – this will be set to "YES" when the last bill for the customer is large. To do this, we need to access an attribute value in the stream, but which is not in any of the input pipes to the stream - only in the stream output. To do this, you will use the internal variable _out:

  1. Add a new attribute called SpecialProcessing
  2. Leave the default settings
  3. Start the attribute expression with:

    if (_out.BillCategory == "LARGE", "YES", "NO")
  4. Press 

Run stream

  1. In the main stream configuration form, press 
  2. Remember to save your model layout.
  3. Run analysis on Reformatted Customer Details
  4. Have a look at the data in the new stream – check that all your transformations have been correctly applied
  • No labels