Solved

Adding Field

Posted on 2004-10-01
3
154 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 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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