Versions Compared

Key

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

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

...

Also, you have to configure your own SQL Autocomplete Script for the custom fields with autocomplete.

Info

Important

If you want to use two columns in the select statement, the first column is the label, and the second is the value. If you only have one column in the select statement, this will be both the label and value.

...

Code Block
select id from car_parts
where brand like 'Toyota';
Note

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

...

Code Block
languagesql
select name from TestTable
where name like {%query%}

Note
Note

We tested the above scripts using ojdbc6.jar.

There is a bug that results in an issue where the LIKE operator causes a problem in the parser, existing in ojdbc7.jar, that makes the scripts unusable for Oracle.

As a workaround, we recommend that you use the concat operator:

  • For searching in the beginning of the text:

Code Block
languagesql
select name from TestTable
where name like concat({query}, '%')
  • For searching in the end of the text:

Code Block
languagesql
select name from TestTable
where name like concat('%', {query})
  • For searching anywhere in the text:

Code Block
languagesql
select name from TestTable
where name like concat(concat('%', {query}), '%')