Solved

Adding Field

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SUM 2 INTEGER ARRAYS INTO 1 10 111
Base1 Encode/Decode 3 85
how can i delete one control based on its tagstring ? 6 34
Get weeknumber and year from date 4 25
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 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