Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

  • Create macros
  • Use macros

...

Creating macros

  1. Find
    Insert excerpt
    _

...

  1. macros
    _

...

  1. macros

...

  1. nopaneltrue
     in the repository
  2. Right-click and select
    Insert excerpt
    _addIcon
    _addIcon
    nopaneltrue
     Add Macro
  3. Configure the macro:
    1. Name: NumOfWeeks
    2. Minimum Parameters: 2
    3. Maximum Parameters: 2
    4. Expression: create an expression to work out the number of weeks - as a whole number – between two dates
      1. Use the functions dateDiff() and round() to help with this
  4. Press 

...

  1. Insert excerpt
    _

...

  1. finish
    _

...

  1. finish
    nopaneltrue
     to save your new macro

Using Macros

  1. Create a new model: Try Macros
  2. Drag the

...

  1. table MC Macro Terminated Customers on to your model
    1. This contains some key dates for terminated customers: the signup date; the date that the customer terminated their service; the date that the final debt on the customer's account was cleared
    2. Add attributes for:
      1. the number of weeks between signup and termination
      2. the number of weeks between termination and the final debt being cleared
  2. In each case, use your macro to calculate the number of weeks between the two dates
  3. Run the

...

  1. table MC Macro Terminated Customers to test your new attributes