Automatically select Data Types based on Variable name in Service Studio

How It Works: Naming Conventions for Automatic Data Types

OutSystems Service Studio uses predefined naming rules to determine the data type of variables automatically. Here’s how it works:

  • Variables ending in “Count” are assigned the Integer data type.
  • Variables ending in “Date” are set to the Date data type.
  • Variables starting with “Has” are mapped to the Boolean (or Bool) data type.

Examples:

  • A variable named UserCount will automatically be an Integer.
  • A variable named CreatedDate will take the Date data type.
  • A variable named HasAccess will automatically become a Boolean.

This feature saves you from repeatedly using the dropdown menu to set data types, making your development process faster and more consistent.

Caution: Overlapping Rules

While this feature is incredibly useful, overlapping naming conventions can lead to unexpected results. For example:

  • A variable named HasCount will default to an Integer because the rule for “Count” takes precedence over “Has”.
  • Similarly, a variable named HasDate will be assigned as a Boolean, as the “Has” rule overrides the “Date” rule.

To avoid confusion, it’s essential to plan your variable names carefully and test their behavior in Service Studio.

Why Use This Feature?

By following these naming conventions, you can:

  • Save Time: Automate repetitive tasks like setting data types manually.
  • Ensure Consistency: Maintain uniformity across your variables by adhering to naming rules.
  • Improve Readability: Clear and descriptive variable names make your code easier to understand and maintain.

OutSystems Service Studio’s automatic data type assignment is a small but powerful feature that can significantly enhance your development efficiency. By adopting these naming conventions, you’ll not only save time but also reduce errors and improve code readability. Keep this tip in mind as you build your next application!

A selection from our recent work