CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 Calculated field in Grid and Record ???

Print topic Send  topic

Author Message
Rene
Posted: 11/23/2003, 11:58 PM

I am a rookie here. I use CCS 2.2.4 with Access. I have a "Opportunity"
table with columns: OpportunityDescription, AmountProducts , AmountServices,
AmountTotal.
I created a Grid and a MainRecord pages. What I am trying to do (but can't
yet) is just requesting user input for the fields OpportunityDescription,
AmountProducts , AmountServices, and then having the field AmountTotal being
calculated (=AmountProducts + AmountServices) and inserted in the table.

This may be very simple, but I just don't get it. Where and how should I put
this command.

Any help appreciated.

Rene

DonB
Posted: 11/24/2003, 7:07 AM

This can easily be done with the "Custom Insert" property of the MainRecord
object. By default, this will be set up by CCS to insert the columns
displayed in your form. You can add more "Expression"-type columns and do
your calculation there. Alternatively you could do the calculation on the
form, and store the result in a textbox or hidden control. Either of these
presents the opportunity for the client to modify the values, which presents
a risk. However, this avoids the Custom Insert. The "custom" actions are
not evil things to be avoided at all costs, so don't think you are better
off using the second alternative.

You also will need use a Custom Update, if the MainRecord can be updated to
alter the amounts after it is initially inserted.

While you can make the calculation in the form and display it in a Label
control, the Label will not be available for writing back to the database
(they are not actually <INPUT> elements in the html, so therefore they can't
be included in the data posted back by the form when it is submitted).
--
DonB

http://www.gotodon.com/ccbth


"Rene" <rbravoz@yahoo.com> wrote in message
news:bpsdms$igm$1@news.codecharge.com...
> I am a rookie here. I use CCS 2.2.4 with Access. I have a "Opportunity"
> table with columns: OpportunityDescription, AmountProducts ,
AmountServices,
> AmountTotal.
> I created a Grid and a MainRecord pages. What I am trying to do (but can't
> yet) is just requesting user input for the fields OpportunityDescription,
> AmountProducts , AmountServices, and then having the field AmountTotal
being
> calculated (=AmountProducts + AmountServices) and inserted in the table.
>
> This may be very simple, but I just don't get it. Where and how should I
put
> this command.
>
> Any help appreciated.
>
> Rene
>
>

Tony Do
Posted: 12/08/2003, 2:55 PM

I would have the AmountTotal field to be a hidden field, then in your before
insert event have this statement
EventCaller.AmountTotal.Value = EventCaller.AmountProducts.Value +
EventCaller.AmountServices.value


"Rene" <rbravoz@yahoo.com> wrote in message
news:bpsdms$igm$1@news.codecharge.com...
> I am a rookie here. I use CCS 2.2.4 with Access. I have a "Opportunity"
> table with columns: OpportunityDescription, AmountProducts ,
AmountServices,
> AmountTotal.
> I created a Grid and a MainRecord pages. What I am trying to do (but can't
> yet) is just requesting user input for the fields OpportunityDescription,
> AmountProducts , AmountServices, and then having the field AmountTotal
being
> calculated (=AmountProducts + AmountServices) and inserted in the table.
>
> This may be very simple, but I just don't get it. Where and how should I
put
> this command.
>
> Any help appreciated.
>
> Rene
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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