Page 1 of 1

WHERE ?

Posted: 2022-02-04 15:44
by pasbonte
Capture d’écran 2022-02-04 164346.png
image
Capture d’écran 2022-02-04 164346.png (48.94 KiB) Viewed 1505 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 1505 times

Re: WHERE ?

Posted: 2022-02-04 15:50
by jsetzer
What about a new column configured as calculated field using SQL for getting the information from the database.

Re: WHERE ?

Posted: 2022-02-06 09:42
by pbottcher
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.