?
Solved

Adding Field

Posted on 2004-10-01
3
Medium Priority
?
161 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:
Mohammed Nasman earned 500 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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

850 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