WHERE ?

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
pasbonte
Veteran Member
Posts: 178
Joined: 2013-02-06 09:49

WHERE ?

Post by pasbonte » 2022-02-04 15:44

Capture d’écran 2022-02-04 164346.png
image
Capture d’écran 2022-02-04 164346.png (48.94 KiB) Viewed 1496 times
Hello

I am currently working on customizing APPGINI applications.
I am starting (with the help of forum members) to understand the why of the HOOKS folder, I can now customize the email sendings.

But I still block on the display of fields.

Let me explain: I would like to add a data NUMBER OF VISITORS at the end of the DETAil field in the table, but where can this be done? see my screenshot...

Capture d’écran 2022-02-04 164346.png
image
Capture d’écran 2022-02-04 164346.png (48.94 KiB) Viewed 1496 times

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1944
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: WHERE ?

Post by jsetzer » 2022-02-04 15:50

What about a new column configured as calculated field using SQL for getting the information from the database.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 25.10 + all AppGini Helper tools

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1709
Joined: 2018-04-01 10:12

Re: WHERE ?

Post by pbottcher » 2022-02-06 09:42

Hi,

if you want to "learn" the hooks capabilities, here another option that you may try.

In the hook/TABLENAME.php -> _init function you have the $options object that gives you a lot of capabilities for manipulating the way appgini will handle the different settings/parts.

Within the QueryFieldsTV array you will find the fields that are displayed in the TV and how they are build. See https://bigprof.com/appgini/help/advanc ... ist-object

So in your case you can try to adopt the display of the titre field like this:

Code: Select all

	$ar=array_flip($options->QueryFieldsTV);
	$ar['FIELDNAME']='concat(`TABLENAME`.`FIELDNAME`," (",(YOUR_SELECT_STATEMENT where t.LOOKUPFIELD='.$options->PrimaryKey.'),")")';
	$options->QueryFieldsTV=array_flip($ar);
Replace the TABLENAME, FIELDNAME and YOUR_SELECT_STATEMENT with your appropriate data. You may need to adjust the

YOUR_SELECT_STATEMENT where t.LOOKUPFIELD='.$options->PrimaryKey.'

if you have a more complex statement with additional WHERE clause parameters.

This is basically similar to the calculated field approach, but does not create a new field.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply