gkm
Posts: 20
|
| Posted: 06/20/2007, 4:47 AM |
|
I have to create an editable grid from a table. In this grid I inserted via "lookup" some fields from other tables. I need this fields in order to calculate a value for a table based field in the grid.
When I use the "BEFORE SHOW ROW" event with custom code, I cannot get any value from the "looked up" fields.
How can I get access to "looked up" fields in custom code?????
Please help
Thanks in advance
Gerrit Mueller
|
 |
 |
wkempees
|
| Posted: 06/21/2007, 2:59 AM |
|
These lookup fields are they displayed in the Editable Grid?
Are they static, meaning just displayed not listboxes?
If so, alter your SQL Select through VQB, to include the lookuped fields.
You will then have all the data in your DataSet and can do whatever you like
withit.
Also when the grid is displayed all data is fetched at once, if you do
lookups, first you main data is getched and then for every row an extra
number of SQL selects is fired, one for every lookup in every row.
Walter
|
|
|
 |
gkm
Posts: 20
|
| Posted: 06/21/2007, 10:15 AM |
|
Dear Walter,
thank very much for answering. Yes there are static components on the grid only. But I do not think, that I may include the lookup-fields via VQB in my select, because this is an editable grid, which means, that the data can be updated or stored, thus my postgresql database will not agree, when fields from other tables are included, when storing the data.
By now my procedure was this way:
1. lookup the value of grid field, which should be calculated (in the moment it is empty)
2. lookup the value of a foreign field in a foreign table.
3. store it as a global variable
4. Do so with other necessary foreign fields
5. do the calculations
6. write back the result in the grid
7. Resore the grid with table-fields only
All this I have done with "Before Show" on field level. This is why I saw that I had to arrange the foreign fields left side in the grid and the result fields right side. This is because CCS works with these events from left to right.
I think you have a better understanding of CCS than me, thus I am happy when you can show me a better way.
Thank you in advance
Gerrit Mueller
Austria
|
 |
 |
Wkempees
|
| Posted: 06/22/2007, 4:44 AM |
|
Quote :
But I do not think, that I may include the lookup-fields via VQB in my
select, because this is an editable grid, which means, that the data can be
updated or stored, thus my postgresql database will not agree, when
fields from
other tables are included, when storing the data.
You can in fact (any DB) make the 'complex' SQL in VQB.
The GridBuilder will complain that it cannot do Insert Update Delete
action on multiple tables, but that is why Yes has given us Custom
Insert/Update/Delete.
The rest of your text is to specific for me, but I think from your text
you need to rethink the way you are handling this.
BeforeShowRow you can (if you really want to) CCDLookup() the values to
base your calculations on and stuff the result in the
$Component-<fieldname>.
There are some really good posts in the forum re handling editGrid rows. http://forums.codecharge.com/posts.php?post_id=60507
Walter
|
|
|
 |
gkm
Posts: 20
|
| Posted: 06/22/2007, 9:38 AM |
|
Walter,
you are right with your opinion. I will rethink the way to handle the data for calculations.
Thank you very much for your support
I remain with best wishes
Gerrit
|
 |
 |
|