Integer and email on insert

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
fciprian
Veteran Member
Posts: 52
Joined: 2020-04-20 10:51

Integer and email on insert

Post by fciprian » 2020-11-07 10:07

Hello

I need some support please.
I have set up to send me an email when a record is added.
Everything works well. BUT :) on a field that is Integer -> Lookup field is only showing me a number (the ID of the raw that i selected).

So i have :
ID Name
1 Ion Marin
2 Cercel Adrian
3 Andrei Victor

And on the email is shows me 2 (the ID). How can i search to table that is Integer and show me directly in email the Name?

Thank you

User avatar
aarlauskas
Veteran Member
Posts: 127
Joined: 2019-04-28 18:03
Location: Medway, UK

Re: Integer and email on insert

Post by aarlauskas » 2020-11-07 22:32

Put this at the beginning of your email script, new line for each lookup field (change parent table & field names accordingly). Lets say your field name is: employee

Code: Select all

$employee = sqlValue("select PARENT_FIELD_NAME from PARENT_TABLE_NAME where id='{$data['employee']}'");


Then where you have your current code for your field put this instead.

Code: Select all

"Employee Name: $employee \n" .

fciprian
Veteran Member
Posts: 52
Joined: 2020-04-20 10:51

Re: Integer and email on insert

Post by fciprian » 2020-11-09 11:42

Thank you verrrrrryyyy muuuuuccccchhhhhh! :X
I have one more question.. please please please :X

So i have 2 fields with Check box. If it is checked in database is 1 and if it is not in 0.
How can i make in email to show me in sted of 1 to be shown YES and if it is 0 to be shown NO in the email ?

I apriciate your help!!!!

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Integer and email on insert

Post by onoehring » 2020-11-13 07:02

Hi,

try similar top aarlauskas solution (code not tested):

Code: Select all

$checkbox_word = (sqlValue("select CHECKBOX_FIELD from TABLE_NAME where id='{$data['selectedID']}'") == 1 ? 'Yes' : 'No';
Olaf

Post Reply