Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This type of data source helps you obtain the values which will populate the custom field using SQL scripts.

...

Info
titleImportant

If you want to use two columns at the select statement, note that the first column will be considered as the label, and the second will be the value.
If you have only one column in the select statement, this will be interpreted as label and value at the same time.

...

After you have selected the SQL Data Source, you will have one of the following options.

Option 1

If you have a custom field with autocomplete and you want to set Min. chars on 0, you need to write the following sql scripts: SQL Initial Script and SQL Autocomplete Script.

...

Code Block
titleSQL Autocomplete Script
select name from car_parts
where brand like {query} || '%';

Option 2

If you have a custom field with autocomplete and you want to set Min. chars on a value greater than 0, you need to type the SQL Autocomplete Script.

Option2

Code Block
titleSQL Autocomplete Script
select brand from car_parts
where name like {query} || '%';


Option 3

If you have a custom field with no autocomplete, you need to type the SQL Initial Script.

Option3  

...

Note

If you want to use the like operator in your sql scripts, you have to use the concatenation symbol between query and the "%" symbol.

Using SQL Datasource on several databases

For most databases, the process described above works just fine. 

...