Concat text + field + text in hook

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
naturick
Veteran Member
Posts: 39
Joined: 2014-07-07 18:47
Location: Cluj-Napoca
Contact:

Concat text + field + text in hook

Post by naturick » 2017-11-01 14:08

Hello, sorry for banal question

I would like to aucomatic insert concat value in a field acting on "before insert section" on hook.
At the same time I need that this field is read only for users...

SOME_TEXT + ['field1_value'] + SOME_OTHER_TEXT

I have tried many ways like:
$data['field'] = "TEXT" & $data['field1_value'] & "TEXT2" ;

but nothing.
Could you please help me?

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Concat text + field + text in hook

Post by AhmedBR » 2017-11-01 15:09

You need to make the field as Readonly in Appgini.

and use sql udpate to set the value in your database, something like this:

Code: Select all

sql("update `YOURTABLE` set `YOURFEILD` = 'THE VALUE YOU WANT' where `ID` = {$data['ID']}", $eo);
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

User avatar
naturick
Veteran Member
Posts: 39
Joined: 2014-07-07 18:47
Location: Cluj-Napoca
Contact:

Re: Concat text + field + text in hook

Post by naturick » 2017-11-02 07:02

Thanks.
So you say there is no way to insert value on a field as "concat" between text and value from another field, by using expression like:

$data[field] = concat expression

The only way is by sql.

User avatar
naturick
Veteran Member
Posts: 39
Joined: 2014-07-07 18:47
Location: Cluj-Napoca
Contact:

Re: Concat text + field + text in hook

Post by naturick » 2017-11-02 07:24

SOLVED
Easy as drink a glass of water:

$data['field'] = 'TEXT' . $data['field1_value'] . 'TEXT2';

Simply using . (dot)

Post Reply