From Clomosy Docs

(Created page with "A global variable can be created in the project. To create a global variable, parameters must be defined. These parameters can be used in any desired unit within the project.<br> <div class="alert alert-warning" role="alert" data-bs-theme="light"> The process of creating parameters is located under the "User Defined Params" section on the Application Development Environment page. </div> When the '+' button is clicked in the Para...")
 
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 126: Line 126:
</div>
</div>
</div>
</div>
After the parameter registration process is completed, the GetProjectUserDefParam function is used to access this data. The function definition is as follows:<br>
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function Clomosy.GetProjectUserDefParam(Param_Name).FieldByName('Field_Name').AsString : String
</div>
<b>Example</b><br>
To use the example, a new parameter should be added as shown below.<br>
<div class="alert alert-dark" role="alert" data-bs-theme="light">
Param Name = user_information<br>
Value Str = Alex // first name<br>
Value Text = Dean // last name<br>
Value Integer = 28 // age<br>
Value Float = 85.8 // weight<br>
Value Date = 25.05.1996 // date of birth
</div>
<div class="alert alert-warning" role="alert" data-bs-theme="light">
<b>Remember!</b><br> These parameters cannot be changed while the application is in use. If an update is needed, click on the parameter created in the development environment, modify the values, and then click the add button again.
</div>
<pre>
var
firstName,lastName,age,userWeight,dateOfBirth : String;
{
firstName =
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Str').AsString;
lastName =
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Text').AsString;
age =
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Integer').AsString;
userWeight =
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Float').AsString;
dateOfBirth =
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Date').AsString;
ShowMessage(firstName);
ShowMessage(lastName);
ShowMessage(age);
ShowMessage(userWeight);
ShowMessage(dateOfBirth);
}
</pre>
<h2> See Also </h2>
* [[Clomosy_Class#Parameter_Definition_and_Global_Variables | Parameter Definition and Global Variables]]
{{#seo:|description=Learn how to define and retrieve global parameters in Clomosy projects using the GetProjectUserDefParam function, with examples application.}}

Latest revision as of 11:07, 24 December 2024

A global variable can be created in the project. To create a global variable, parameters must be defined. These parameters can be used in any desired unit within the project.

When the '+' button is clicked in the Parameters tab, a "Add Param" box appears on the page as shown below.

AddParamV1.0.png

1

Param Name

The parameter name is being defined. The parameter has multiple data storage fields: (Value Str, Value Text, Value Integer, Value Float, Value Date).


2

Value Str

It represents the field name where string data for the parameter will be stored.


3

Value Text

It represents the field name where long textual data related to the parameter will be added.


4

Value Integer

It represents the field name where numerical data related to the parameter will be added.


5

Value Float

It represents the field name where decimal numerical data related to the parameter will be added.


6

Value Date

It represents the field name where date data related to the parameter will be added.


7

Add Param

After creating the parameter and adding the desired entries to the respective fields, the parameter addition process is completed by clicking the button to perform the addition.

After the parameter registration process is completed, the GetProjectUserDefParam function is used to access this data. The function definition is as follows:

Example
To use the example, a new parameter should be added as shown below.


var
 firstName,lastName,age,userWeight,dateOfBirth : String;
 
{
 firstName = 
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Str').AsString;
 lastName = 
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Text').AsString;
 age = 
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Integer').AsString;
 userWeight = 
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Float').AsString;
 dateOfBirth =
Clomosy.GetProjectUserDefParam('user_information').FieldByName('Value_Date').AsString;
 
 ShowMessage(firstName);
 ShowMessage(lastName);
 ShowMessage(age);
 ShowMessage(userWeight);
 ShowMessage(dateOfBirth);
}

See Also