This topic is locked

Create number to show in field

8/29/2010 4:24:19 PM
PHPRunner General questions
A
ashumak author

I am trying to create a "Heat Ticket' custom number to show when we add a new entry. I used the code from another listing, added it to the "Table Events:Add page: Before process.
$sql="select max(substr(Heat_Ticket,9)) as mx from customer_service_log where substr(Heat_Ticket,7,2)=month(now()) order by mx";$rs=CustomQuery($sql);$data=db_fetch_array($rs);$str="HT";$str2=date("Ym");$str3=($data["mx"]+1);$values["Heat_Ticket"]="$str$str2".str_pad($str3, 5, 0, STR_PAD_LEFT);
The after record event sends an email with the created number, unfortunately on the add page, nothing shows until after it is added. I need this to show prior to the record being added as a reference.
Any help is appreciated.

A
ann 8/30/2010

Alan,
to calculate the value directly on the page you need to use JavaScript API, unfortunately it won't select the values from other table.

The only way to calculate such field on the page is to create a button which will fill in the corresponding field value.