CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge -> General/Other

 SOLVED - Custom Code - MySQL with more than one GREATEST - Fails

Print topic Send  topic

Author Message

Posts: 2
Posted: 10/10/2009, 10:54 PM

The following custom code (After Update Event) works when coded with ONE 'GREATEST' statement. Yes, it works for either variable (only one at a time).
When I do two "GREATEST" statements (or more), it fails.
I feel I have verified the inputs (text boxes of 'mar' and 'surg') are correct.

CODE that does not work on CodeCharge; but, does work in MYSQL (substituting values of course):
$SQL="UPDATE t_cptfee ".
" set ".
" mar = ".
" GREATEST(".CCGetParam(mar)."+0,0), ".
" mar_note = ".
" '".CCGetParam(mar_note)."', ".
" surg = ".
" GREATEST(".CCGetParam(surg)."+0,0), ".
" surg_note = ".
" '".CCGetParam(surg_note)."', ".
" uuid = ".
" ".$user.", ".
" udt = ".
" utc_timestamp() ".
" where ".
" pk_cptfee = ".CCGetParam(pk_cptfee)." ";

As always, I suppose I'll get various ways to avoid the use of GREATEST; however, this should work!

Temporally, I'm doing many updates in the custom code (one text box variable at a time) in multiple MySQL queries.

Oh.. I'm on CodeCharge Studio
Vaughn Frost
View profile  Send private message

Posts: 2
Posted: 10/13/2009, 10:09 AM

The issue was that prior Parameters were being passed that had different numerical values.
The "GREATEST" (multiple times in SQL) works as designed.
Vaughn Frost
View profile  Send private message

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.