This topic is locked
[SOLVED]

 Can we access results of Lookup Wizard as objects?

2/9/2011 5:31:19 PM
PHPRunner General questions
V
Vienna author

To speed database queries and make tables of records smaller I have used a numeric value stored in a field as much as possible so that even a simple "yes" or "no" is represented by "1" and "0". The days of the week are represented by single digits 1 to 7.
So the details forms use lookup wizards a lot to refer to lookup tables to see what we "really mean" by a "4" in field "days", as an example.
But when I try to send out an email in the Events scripting after a record is created or updated the email arrives with some text but too many inexplicable numbers.
So, is there a way to reference the output of my lookup wizards for both master table and details tables forms so that they hang around ready to go to work whenever referred to? So that I can send out an email where the selected field value 7 in a dropdown that reads options "Sunday, Monday, Tuesday," ....etc will send "Saturday" instead of the literal value 7?
Thanks for your fix!

J
Jane 2/10/2011

Hi,
you can select values from lookup tables manually in your event.

Here is just a sample how to create user-friendly email:

global $dal;

$msg = "";

//simple text or numeric fields

$msg.="FieldName1: ".$values["FieldName1"]."\r\n";

$msg.="FieldName2: ".$values["FieldName2"]."\r\n";

//lookup fields

$dal_lookuptable = $dal->Table("LookupTable");

if ($values["FieldName3"])

{

$rstmp1 = $dal_lookuptable->Query("LinkField=".$values["FieldName3"],"");

$datatmp1 = db_fetch_array($rstmp);

$msg.="FieldName3: ".$datatmp1["DisplayField"]."\r\n";

}

...



where FieldName1, FieldName2, FieldName3, LinkField and DisplayField are your actual field names, LookupTable is your actual table name.

V
Vienna author 2/10/2011



Hi,
you can select values from lookup tables manually in your event.

Here is just a sample how to create user-friendly email:

global $dal;

$msg = "";

//simple text or numeric fields

$msg.="FieldName1: ".$values["FieldName1"]."\r\n";

$msg.="FieldName2: ".$values["FieldName2"]."\r\n";

//lookup fields

$dal_lookuptable = $dal->Table("LookupTable");

if ($values["FieldName3"])

{

$rstmp1 = $dal_lookuptable->Query("LinkField=".$values["FieldName3"],"");

$datatmp1 = db_fetch_array($rstmp);

$msg.="FieldName3: ".$datatmp1["DisplayField"]."\r\n";

}

...



where FieldName1, FieldName2, FieldName3, LinkField and DisplayField are your actual field names, LookupTable is your actual table name.


Outstanding! Exactly what I needed! Thank you, Jane!