Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ControlSource in Grid based on Calc'd Field
Message
From
16/11/2001 05:37:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
15/11/2001 15:17:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00582336
Message ID:
00582621
Views:
37
This message has been marked as the solution to the initial question of the thread.
>Does anyone know how to build a field in a grid where there is no underlying field in a table? For example, if you had a Product Code field and wanted to show the product's description in the next column, but the grid's underlying table does not have a description field so the value must come from the product table. Since it is a grid, I will have many different product code/product description visible at once.
>
>Thanks in Advance,
>Sandi

Sandi,
Assuming your description table is open (only open, no need for set order, relation etc) :

-Add a grid column by increasing columncount (for description field). Adjust its columnorder to your taste.
-In column controlsource enter your expression :
(iif(seek(grdTable.proccode,'products','proccode'),products.description,''))
Where grdTable is alias of your grid's recordsource (with product code). Anytime proccode field changes, instantly description changes :)
PS: If you would assign the controlsource in code do not forget doublequotes. If your expression is wrong (ie: misspelling fieldname) you'd get a blank grid. This works with buffered, non-buffered. If your column is not the last column in grid you might want to code 'return .f.' into text1's 'when' (already readonly) to skip column when navigating in grid left-right.
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