Skip to main content

 

 

 

Template:OutSystems/Documentation_KB/Breadcrumb_New_Layout

 

 

Template:OutSystems/OSLanguageSwitcher

 

Applies only to Mobile Apps and Reactive Web Apps

 

 

OutSystems

Counter

Template:OutSystems/Documentation_KB/ContentCollaboration
  • Edit
    Collaborate with us
    Edit this page on GitHub
  • You can use the Counter UI Pattern to display numerical information as a notification. For example, the Badge UI pattern is frequently used to notify users about the number of unread emails, unopened messages, or new tasks they may have.

    How to use the Counter UI Pattern

    The following example demonstrates how you can display the number of registered users on your platform.

    1. In Service Studio, in the Toolbox, search for Counter.

      The Counter widget is displayed.

    2. From the Toolbox, drag the Counter widget into the Main Content area of your application's screen.

      By default, the Counter widget contains a Content placeholder.

    3. To create an aggregate (in this example to retrieve all the users on the platform), right-click the screen name and select Fetch Data from Database.

    4. To add a database entity, click the screen, and from the Select Source pop-up, select the relevant entity and click OK. In this example, we select the User entity.

      The aggregate GetUsers is created.

    5. To reopen your screen, select the Interface tab, and double-click on your screen.

    6. From the Toolbox, drag an Expression widget into the Content placeholder, and in the Expression Editor enter the following expression and click Done.

      GetUsers.Count

    You have now created an expression that displays the Count property of the Aggregate you created earlier, which gets and displays the number of users on your platform.

    1. On the Properties tab, you can customize the Counter's look and feel by setting any of the optional properties, for example, the height and orientation.

    After following these steps and publishing the module, you can test the pattern in your app.

    Properties

    Property Description
    BackgroundColor (Color Identifier): Optional The counter's background color. Red, orange, yellow, lime, green, blue, violet, and pink are just some of predefined colors available for the badge.

    Examples

    • Blank - No background color is applied to the counter. This is the default.
    • Entities.Color.Red - Displays a red counter.
    IsVertical (Boolean): Optional If True, the content is displayed vertically. If False, the content is displayed horizontally. This is the default.
    Height (Text): Optional The counter's height (in pixels units). By default the counter height is 100 (pixel units).
    ExtendedClass (Text): Optional Add custom style classes to the Counter UI Pattern. You define your custom style classes in your application using CSS.

    Examples

    • Blank - No custom styles are added (default value).
    • "myclass" - Adds the myclass style to the Counter UI styles being applied.
    • "myclass1" "myclass2" - Adds the myclass1 and myclass2 styles to the Counter UI styles being applied.
    • Was this article helpful?