CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 insert the sum of two fields

Print topic Send  topic

Author Message
giorgino

Posts: 2
Posted: 09/11/2014, 9:22 AM

Hi,
I'm new to CodeCharge, and I've been fighting for two days with this problem:
I havbe an Editable Grid (created with the proper builder), which I use to insert data into a mysql table (the programming language is PHP). It has three fields:

- Price
- Fee
- Total

What I'd like to do, is to insert into the database table the "total" column as a sum of Price + Fee. I know I could do it easilywith a mysql trigger, but I do prefer to learn the CodeCharge way.

I managed to add (as a test) a "before submit" event with
$gridname->Total->SetValue( 100 ) 
, and it's working (it does insert the 100 value in the DB). However, if I try something like
$gridname->Total->SetValue( $gridname->Price->GetValue() + $gridname->Fee->GetValue() )
, no value is inserted into the database table. What am I doing wrong ? I tried to place different custom codes almost everywhere, with no luck. I also tried the "custom insert" property, with no luck again.

Please note that, as of now, Price and Fee are "textbox", while Total is a "label". It's not necessary to have the total calculated realtime (javascript).

Thank you for your help!
Regards,
Giorgio
View profile  Send private message
giorgino

Posts: 2
Posted: 09/12/2014, 2:47 AM

finally I got it, looking ant the source PHP code. the right answer is:

$this->f210_fee->GetValue(true) + $this->f210_related_expenses->GetValue(true)

(I was missing the "true" parameter)
View profile  Send private message
asadkhan


Posts: 1
Posted: 10/28/2014, 2:04 AM


http://forums.yessoftware.com/posts.php?post_id=123479#
_________________
Asad Khan
View profile  Send private message
Waspman

Posts: 948
Posted: 10/31/2014, 12:12 PM

You were right the first time, but total as a label was your problem.

_________________
http://www.waspmedia.co.uk
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 http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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