Code execution for results


New member
Hi to all,
I am trying to create some code, that is to be executed each time a results page is loaded.
The code is supposed to check whether some table entries have specificic values and/or a date is passed and an item is expired.
Could you help on how to achieve all this?
Many thanks in advance!!!


Staff member
you can use an HOOK, maybe a before results grid header hook (see documentation).

The code of your custom function depends on what you need to do specifically, probably you'll have to execute some queries on the table you are showing.



New member
Hi again,

I got stumbled in other issues and resigned from the effort to complete the above task. However currently I am trying to figure out how to code this hook and cant find my way. My goal is to detect date entries and that are passed in relation to the current data. Each time a user loads to see the table I want to give him and indication of items that are expired (if any).
I have come up with 2 possible solutions but I cant figure out how to implement them.
My first approach is to use a formatting function, compare the date from the table with the current date and then color the entry with red color if the item is expired. However If I am correct, the formating function is called upon insertion or update of the data entry.
The second option I thought is to create a column in my data table with an enum value, and use the hook function you mentioned in order to check if any item is expired and if so, update the table column with the value EXPIRED. In this case however I cant figure out how afterwards I can mark the entry in red color.

ps.: I have already used code that colors an entry or a value in the table, using formatting functions.

Many thanks in advance!

You are using DaDaBIK version 11.2-Elba enterprise, installed on 10-03-2022, the latest version of DaDaBIK is 11.4-Elba released on 28-02-2022

System info
PHP Version: 7.4.27
mysql version: 5.5.5-10.4.22-MariaDB
Web server: Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/7.4.27
Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36