You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Definition

This plugin is designed to enhance Joget DX 8 functionality. Known as the JDBC Validator, it empowers users to conduct validations through custom SQL queries. With this capability, users can ensure the accuracy and consistency of their data within the Joget DX 8 platform.


New Feature

When crafting the SQL query, users have access to dynamic parameters to retrieve form field values. Two primary symbols are available for this purpose: the question mark '?' and curly braces '{fieldId}'. These symbols serve distinct functions in data retrieval.

The question mark '?' is utilised to fetch the current form field's value within the SQL query. It enables users to perform validations based on the data input provided by the user during the form-filling process.

On the other hand, the curly braces '{fieldId}' serve a different purpose. They allow users to access values from other form fields, not necessarily the one currently being validated. This versatility is valuable in scenarios where cross-field validation is required, enabling comparisons and dependencies between different form elements.

By leveraging these dynamic symbols within their SQL queries, users can create sophisticated validation rules tailored to their specific business requirements. Whether it's simple data checks or complex inter-field relationships, the JDBC Validator provides a flexible and powerful solution to ensure data integrity and compliance within the Joget DX 8 environment.

Figure 1: JDBC Validator Properties






Assuming you have a Joget DX 8 form that deals with budget entries and you want to validate whether a budget entry with the same year ('c_year') and name ('c_name') already exists while excluding the current budget entry (identified by its 'id'), you can use the following SQL query within the JDBC Validator:

SELECT * FROM app_fd_budget WHERE c_year = {year} AND c_name = {name} AND id != {id}


Explanation:

  1. SELECT * FROM app_fd_budget: This part of the query selects all columns ('*') from the 'app_fd_budget' data store. The data store in Joget is similar to a table in a database, and 'app_fd_budget' is the name of the data store containing budget entries.
  2. WHERE c_year = {year} AND c_name = {name} AND id != {id}: This is the WHERE clause, which filters the results based on specific conditions.c_year = {year}: Here, the curly braces '{year}' denote a placeholder for the value of the 'c_year' field that will be supplied during the execution of the query. In Joget DX 8, you can use '{year}' to represent the value of a form field with the ID 'year'. This part of the condition checks if the 'c_year' field in the 'app_fd_budget' data store matches the value of the 'year' form field.
  • c_name = {name}: Similarly, the curly braces '{name}' represent a placeholder for the value of the 'c_name' field that will be supplied at runtime. In Joget DX 8, you can use '{name}' to represent the value of a form field with the ID 'name'. This part of the condition checks if the 'c_name' field in the 'app_fd_budget' data store matches the value of the 'name' form field.
  • id != {id}: Here, the curly braces '{id}' denote a placeholder for the value of the 'id' field that will be supplied during query execution. In Joget DX 8, you can use '{id}' to represent the value of a form field with the ID 'id'. This part of the condition ensures that the 'id' field of the budget entry does not match the value of the 'id' form field. The purpose of this condition is to exclude the current budget entry (identified by its 'id') from the results. This way, you prevent false validation failures when editing an existing budget entry.







  • No labels