Exercise 1.5 - Create and Use Constants

Modified on Fri, 13 Oct 2023 at 06:22 PM

A Constant is simply a value you define in one place only and then can use from everywhere else. This has a couple of advantages:

  • By changing the value of the Constant itself you are in one go changing the value everywhere this Constant is used
  • You can use the Cross Reference functionality of the Studio to find all the places this constant is used


Additionally, there is another significant aspect of Constants. They come in 2 different flavors:

  • Static: The value of static Constant is defined in Studio - nice and easy
  • Runtime: The value of the Constant can be modified at Runtime (in the Portal Operations and Runtime). Runtime constants are in all respects like parameters to the migration that may change between iterations. For instance, it is very common to have a runtime Constant containing the date of the migration that corresponds to the source data that has been staged.  


In this exercise, you will create a constant and also use it to map the value of a Target Field.


Create Constant SystemId_Card


  • In Project Explorer, locate the folder node Constants. Right-click and choose New in the context menu
  • Name: SystemId_Card
  • Runtime checkbox: Leaving this unchecked, making this a static Constant (and not a runtime Constant, see above)
  • Format: Char (default)
  • Length: 4
  • Description: Specifies that the item is created from BO Card
  • Value: Card
  • Save (ctrl-s)


Use Constant SystemId_Card in when mapping Target Objects Tgt.Card 


  • In Project Explorer, locate and open Card > Tgt.Card
  • Assign the new Constant SystemId_Card to Target Field SystemId
  • Save (ctrl-s)


And Tgt.Card_Status

  • In Project Explorer, locate and open CardStatus > Tgt.Card_Status
  • Assign Constant SystemId_Card to target object field SystemId
  • Save (ctrl-s)



What happened here?


Well, it wasn't the biggest exercise of all, but you did create yourself a brand new Constant. You also learned that Constants come in two variants

  • Static, with a value defined locally in Studio
  • Runtime, with a value that is defined at a later stage, as a parameter to the migration.


And then you used your Constant to assign the value of a couple of Target Fields, and by that, you have extended your value types with a new one

  • Interface
  • Literal
  • Target
  • Constant, to use a Constant as the value to be assigned


So there was something in there after all.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article