sah-comp / ksm

Application for lending, selling and maintaining forklifts.
0 stars 0 forks source link

Scaffolding: Filtering per virtual field in a JSON blob #116

Closed sah-comp closed 1 year ago

sah-comp commented 2 years ago

A bean may store some (user definded) virtual fields in a JSON attribute. Lets assume a book bean, looking like so:

and details is stored as JSON in the field details:

$detail = json_encode([
    'isbn' => '1234567890',
    'nop' => 128,
    'yop' => '1923'
]);

In a scaffold table view we output the attribute yop, meaning year of publication of the JSON field. This field is currently not working for filtering, because the searchterm will be looked up in the JSON field itselt, not in the virtual field yop.

sah-comp commented 1 year ago

It can be achieved by using JSON_EXTRACT.