Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculated field in grid
Message
From
01/05/2002 02:09:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/04/2002 19:06:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00651144
Message ID:
00651211
Views:
18
This message has been marked as the solution to the initial question of the thread.
>I have a grid with a calculated column made up of addition and subtractions of several of the field values in the table. Example - Sales - Return - Receipts = Balance Due. The calculation is correct when the grid is initalized.
>
>I use the following code to maintain the grid while I am doing other processs using the underlying table such as displaying a screen which summarizes some of the data in the table.
>
>Thisform.grid1.RecordSource = Space(0)
>
>
>When focus is returned to the grid, all the column values are correct except that the calculated column displays the values of one of the email fields in the table instead of the calculated amount.
>
>I tried to reset the recordsource of the calculation column but that doesn't correct the problem.
>
>Anyone have an idea what is happening and how I can get the calculation to display correctly in the grid?
>
>Thanks
>Gaylen

Gaylen,
You should reassign the controlsource for calculated column. When grid doesn't have a controlsource for a column it picks the next from recordsource.
When assigning calculated fields use the aliases + parentheses. Failing to use parentheses is a common cause of blank column.

thisform.myGrid.Columns(n).Controlsource = ;
"(myTable.Example - myTable.Sales - myTable.Return - myTable.Receipts)"

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform