randomizer-number-generator
Service icon

Randomizer Number Generator

icon_trusted
Stable version 2.0.4 (Compatible with OutSystems 11)
Other versions available for 10 and Older
Uploaded
 on 30 August 2021
 by 
4.4
 (17 ratings)
randomizer-number-generator

Randomizer Number Generator

Documentation
2.0.4

GetRandomInt


The next steps will guide you on how to use the GetRandomInt server action. We will implement the server action on the screen in two ways: by using it directly on a client action and by using the server action inside a Data Action. In the end of these steps, you should be able to generate a random integer number in these two different ways.


1. Make the component available on your application.

After installing the component from the forge, manage the dependencies on your application and look for the RandomizerNumberGenerator, you should have available two server actions. Select the GetRandomInt server action.


2. Use the available server action on your screen.

As we stated in the beginning, our goal is to be able to generate a random number by two separate ways. The first one is to use this now available server action on a client action. To do this, simply create a client action and then drag and drop the GetRandomInt server action to its flow.

This action has two input parameters that are mandatory (NumMin and NumMax), these two inputs define the range from which the random value will be generated. In our demonstration, we will use local variables associated with inputs on the screen. Note that these two variables to define the inputs and then the variable to store the result must be of type Integer. You then will have the output of the GetRandomInt server action that will be the generated number, use it as you like. In our case we will display it on our screen.




Another way to use this Server Action is on Data Actions. We just need to assign the output of this Data Action to the execution of the server action, this is easily accomplished by placing an assignment on this Data Action. In our example we are still using the two created local variables to define the range to generate the random number.



GetRandomDecimal


The next steps will guide you on how to use the GetRandomDecimal server action. We will implement the server action on the screen in two ways: by using it directly on a client action and by using the server action inside a Data Action. In the end of these steps, you should be able to generate a random decimal number in these two different ways.



1. Make the component available on your application.

After installing the component from the forge, manage the dependencies on your application and look for the RandomizerNumberGenerator, you should have available two server actions. Select the GetRandomDecimal server action.


2. Use the available server action on your screen.

As we stated in the beginning, our goal is to be able to generate a random number by two separate ways. The first one is to use this now available server action on a client action. To do this, simply create a client action and then drag and drop the GetRandomDecimal server action to its flow.


This action has two input parameters that are mandatory (NumMin and NumMax), these two inputs define the range from which the random value will be generated. In our demonstration, we will use local variables associated with inputs on the screen. Note that these two variables to define the inputs and then the variable to store the result must be of type Decimal. You then will have the output of the GetRandomDecimal server action that will be the generated number, use it as you like. In our case we will display it on our screen.



Another way to use this Server Action is on Data Actions. We just need to assign the output of this Data Action to the execution of the server action, this is easily accomplished by placing an assignment on this Data Action. In our example we are still using the two created local variables to define the range to generate the random number.