auto_stories Knowledge Base chevron_right Actions chevron_right Article

Validation

This action is used to prevent proceeding to the next action if certain conditions are not met, or to define the registration conditions.

mceclip7.png

 

Validation action properties

 

Description:  A description of the action is written.

This description is a reference field that later shows the application developer which action is used for what purpose. The value written here corresponds to this field in the actions menu.

mceclip0.png

Heading:  When added as a form action, it specifies the name in the action list.

Represents the text that will appear in the selection field when the designed validation action is to be triggered within different actions.

mceclip1.png

SQL Query: If the query result is 0, all operations are stopped and a warning message is displayed. If the result is 1, the operation continues.

mceclip2.png

Warning Message: The message to be displayed when the condition is not met is written here.

User Password Check:  Ensures that the username and password are checked for the action to work.  Click for an example.

Run Condition:  If the value entered in this field is ‘0’, the relevant operation will not run.

mceclip4.png

Request Confirmation:  Select whether you want to request confirmation before running the action. If Request Confirmation is active, the Confirmation Message feature opens and the message to be displayed when requesting confirmation is written.

mceclip5.png

Confirmation Message: The message content to be displayed in the pop-up window opened for confirmation is written in this field.

mceclip6.png

 

blobid0.png

The order of actions in Xpoda is important. When the Validation action is triggered, it blocks the subsequent action. For this reason, you must place the action you want to run before the Validation action in the action order.

 

 

──────────────────────────────

Example Used

There is a text box on the form for users to enter their phone numbers. Before the values on this form page are saved, you want to check the length of the phone number.

Select Validation from the Operation field and write a query in the query field. This query returns a result of 0 or 1. If the result is “0”, it means the event is stopped.  In this case, the form is not saved. A result of “1” means this event has passed the check and the save operation is performed.

mceclip1.png

In this example, since the phone number is to be entered as 10 digits, the query is created accordingly.

When 2 characters are entered in the field where the phone number is to be entered, the following error will appear on the screen.

mceclip2.png

mceclip3.png

Although an error is given, no saving process can be performed.

──────────────────────────────

Example 2

User Check Usage

Let's add three basic elements to the form screen: drop-down box, text box, and button. Let's use the drop-down box element to list the users in the XPODA_CLIENT_USERS table.  Let's activate the “Selection compulsory” property of this element so that the user must make a selection.

Write the SQL query as follows:

SELECT

         XPODA_CLIENT_USERS.UserID,

         XPODA_CLIENT_USERS.UserFullName

FROM

         dbo.XPODA_CLIENT_USERS WITH (NOLOCK)


Add the textbox element for the user to enter their password. If we set the mask field to “Password,” the characters entered will appear as asterisks.

Let's use the button element to verify the user information. Let's add two actions to this element: validation and show message.

Let's use the button element to verify the user information. Let's add two actions to this element: validation and show message.

SELECT '$PUser$' , '$PUserpassword$' 

In the validation action, let's enable the “user password check” feature. Let's write the following query in the SQL Query field:

“User information is incorrect. Please check and try again.”

If validation is successful, let the show message action take effect and display the message “User information is correct” to the user.

 

Go to the Client screen and add this form to the menu. The user selects a user from the drop-down box element, enters their password in the textbox element, and clicks the button to start the check.

If an incorrect password is entered, the validation action fails, and the warning message appears on the screen.

If the password field is not starred, the entered password is visible.

When the correct password is entered, the validation action succeeds, the show message action is triggered, and the message “User information is correct.” appears on the screen.

If the password field is not starred, the password is again visible.

 

──────────────────────────────

Example 3

When the second data returned in the query within the validation contains an error message, the error message can be dynamically displayed on the screen. This way, the error message will be determined directly from SQL and used.

The action that will run is On Value Change>Validation action.

Example query written in the SQL Query field:

SELECT CASE WHEN '$PActiveUser$' = 1 THEN 1 ELSE 0 END,

'Error occurred' WHERE CASE WHEN '$PActiveUser$' = 1 THEN 1 ELSE 0 END=0

UNION ALL

SELECT 1 , ''