[ENHANCEMENT]: Support for LIKE operator in Dynamic Get -> Tweak -> WHERE #1226

Closed
opened 2025-06-18 16:45:41 +00:00 by oxido · 5 comments

Enhancement Details

Currently, it is not possible to use the LIKE operator in the dynamic query builder (Tweak → WHERE) within JCB.
I encountered a situation where I needed to search in a database column that stores a JSON array of multiple GUIDs. Since I couldn't use LIKE in the JCB UI, I had to manually adjust the query like this:
$query->where('a.author_guid = ' . $db->quote('%' . $this->_item[$this->input->getInt('id')]->guid . '%'));
to this
$query->where('a.author_guid LIKE ' . $db->quote('%' . $this->_item[$this->input->getInt('id')]->guid . '%'));

I would like to request that the LIKE operator be supported in the dynamic Tweak → WHERE UI and logic, similar to how = is currently supported. This would allow more flexible queries, especially for use cases involving JSON fields, partial matches, or substring searches.

Thank you!

Which part of the extension will be affected by this enhancement?

Compilation of component, Placeholder(admin_view)

Additional Context

No response

### Enhancement Details Currently, it is not possible to use the LIKE operator in the dynamic query builder (Tweak → WHERE) within JCB. I encountered a situation where I needed to search in a database column that stores a JSON array of multiple GUIDs. Since I couldn't use LIKE in the JCB UI, I had to manually adjust the query like this: `$query->where('a.author_guid = ' . $db->quote('%' . $this->_item[$this->input->getInt('id')]->guid . '%'));` to this `$query->where('a.author_guid LIKE ' . $db->quote('%' . $this->_item[$this->input->getInt('id')]->guid . '%'));` I would like to request that the LIKE operator be supported in the dynamic Tweak → WHERE UI and logic, similar to how = is currently supported. This would allow more flexible queries, especially for use cases involving JSON fields, partial matches, or substring searches. Thank you! ### Which part of the extension will be affected by this enhancement? Compilation of component, Placeholder(admin_view) ### Additional Context _No response_
oxido added the
enhancement
label 2025-06-18 16:45:41 +00:00
Owner

We can add this before the next stable release :)

We can add this before the next stable release :)
Owner

This is the purposed new list:

1  | Equal
2  | Not Equal (!=)
3  | Not Equal (<>)
4  | Greater Than
5  | Less Than
6  | Greater Than or Equal
7  | Less Than or Equal
8  | Not Less Than (!<)          -- supported but rarely used
9  | Not Greater Than (!>)       -- supported but rarely used
10 | IN
11 | NOT IN
12 | LIKE
13 | NOT LIKE
14 | IS NULL
15 | IS NOT NULL
16 | BETWEEN
17 | NOT BETWEEN
18 | EXISTS
19 | NOT EXISTS
20 | REGEXP
21 | NOT REGEXP
22 | SOUNDS LIKE                 -- MySQL-specific -- not sure if I should add this

And this is the new compiler array:

/**
 * The operator types
 *
 * @var    array
 * @since 3.2.0
 */
protected array $operator = [
	1  => '=',
	2  => '!=',
	3  => '<>',
	4  => '>',
	5  => '<',
	6  => '>=',
	7  => '<=',
	8  => '!<',
	9  => '!>',
	10 => 'IN',
	11 => 'NOT IN',
	12 => 'LIKE',
	13 => 'NOT LIKE',
	14 => 'IS NULL',
	15 => 'IS NOT NULL',
	16 => 'BETWEEN',
	17 => 'NOT BETWEEN',
	18 => 'EXISTS',
	19 => 'NOT EXISTS',
	20 => 'REGEXP',
	21 => 'NOT REGEXP',
	22 => 'SOUNDS LIKE'
];
This is the purposed new list: ``` 1 | Equal 2 | Not Equal (!=) 3 | Not Equal (<>) 4 | Greater Than 5 | Less Than 6 | Greater Than or Equal 7 | Less Than or Equal 8 | Not Less Than (!<) -- supported but rarely used 9 | Not Greater Than (!>) -- supported but rarely used 10 | IN 11 | NOT IN 12 | LIKE 13 | NOT LIKE 14 | IS NULL 15 | IS NOT NULL 16 | BETWEEN 17 | NOT BETWEEN 18 | EXISTS 19 | NOT EXISTS 20 | REGEXP 21 | NOT REGEXP 22 | SOUNDS LIKE -- MySQL-specific -- not sure if I should add this ``` And this is the new compiler array: ``` /** * The operator types * * @var array * @since 3.2.0 */ protected array $operator = [ 1 => '=', 2 => '!=', 3 => '<>', 4 => '>', 5 => '<', 6 => '>=', 7 => '<=', 8 => '!<', 9 => '!>', 10 => 'IN', 11 => 'NOT IN', 12 => 'LIKE', 13 => 'NOT LIKE', 14 => 'IS NULL', 15 => 'IS NOT NULL', 16 => 'BETWEEN', 17 => 'NOT BETWEEN', 18 => 'EXISTS', 19 => 'NOT EXISTS', 20 => 'REGEXP', 21 => 'NOT REGEXP', 22 => 'SOUNDS LIKE' ]; ```
Llewellyn added this to the Feature Requests project 2025-06-19 13:04:52 +00:00
Owner

This is the Dynamicget class that needs updating.

This is the [Dynamicget](https://git.vdm.dev/joomla/Component-Builder/src/commit/70718936b40019976c6d4cf2c3d39d631486991a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Dynamicget.php) class that needs updating.
Member

@oxido We have rolled out this requested feature in JCB 5.1.1-beta2. Please download and test the latest package and let us know if all works as expected.

@oxido We have rolled out this requested feature in [JCB 5.1.1-beta2](https://git.vdm.dev/joomla/Component-Builder/commit/3c1057a83014584998622c9343c19bc97262f3a3). Please download and test the [latest package](https://git.vdm.dev/joomla/pkg-component-builder/archive/v5.1.1-beta2.zip) and let us know if all works as expected.
Author

This is good, it is working as expected.
Thank you!

This is good, it is working as expected. Thank you!
oxido closed this issue 2025-06-19 22:00:19 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1226
No description provided.