Solved

Adding Field

Posted on 2004-10-01
3
150 Views
Last Modified: 2010-04-05
Hi EveryOne!

 Table:  MONEY.DBF
 Fields:  DESC  ftString   10
            DR      float         0
            CR      float         0
 

  When i want to display the values in the GRID it should be like this one..

  Desc      DR      CR            BALANCE
  0NE       100                     100
  TWO              -20             80
  THREE            -10             70
  FOUR     20                       90
  FIVE               -40             50
  SIX                 -50              0

 Now my question is how will i include the "BALANCE" field on the grid which is that this field "BALANCE" is not included in the TABLE money.dbf? How will i make the formula for this and assigning it to "Balance"

thanks alot!


0
Comment
Question by:girlswants_me
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
mnasman earned 125 total points
ID: 12198152
Hello

   Create Calculated Field, here's how u can do it,

1. Drop Table component than double click on if, when the Field editor open right click and add the fields you would like to use.

2. Right click on the Field editor again and choose New field, New field window will appear to you, define field with name and data type, choose it's type as Calculated

3. From Table's events choose OnCalcField, and write the formula that will calculate your new field, as following:

procedure TForm1.Table1CalcFields(DataSet: TDataSet);
begin
  Table1['MyNewField'] := Table1.fieldByName('MyField').AsInteger * 1.1;
end;

Now you would see the MyNewField add to your DBGrid, and the values will calcuated on the run time, without adding new field to your table

HTH

Regards,
Mohammed
0
 

Author Comment

by:girlswants_me
ID: 12199030
hI,

How will i make the formula for this and assigning it to "Balance"? kINDLY observe the values under the "balance" field... do you know on how to compute those values?
0
 

Author Comment

by:girlswants_me
ID: 12224109
Hi,

I got it, thanks a lot.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now