If you pass the temp-table by reference, it goes out of scope at the end of the constructor, so it's unavailable in any other methods.
You can use BIND instead to keep the reference bound after the method/constructor goes out of scope.
That way you don't have to pass it by value...
Probably a very stupid question, but I just can't figure it out.
Version : OE11.3
I have a:
- infragistics grid
The bindingsource is attached to the grid.
I populate the grid with the following code:
CREATE QUERY hQuery.
hQuery:QUERY-PREPARE("FOR EACH ttdoublesdb").
bindSrc_ttdoublesdb:HANDLE = hQuery.
How comes that the record of temp-table ttdoublesdb doesn't come available when the following events of the grid are fired:
What am I doing wrong here ....
You're right. It seems that the ttdoublesdb buffer should contain the record that is newly selected (AfterSelectChange) or double clicked on (DoubleClickRow). Check the Position property of the BindingSource. This is specifically what tracks/determines the current record in the buffer. The Position property should be getting reset by the control (usually indirectly via internal CurrencyManager object). Maybe that is not working as you would expect.
The bindingsource gives me position 0.....
Always?? Regardless of which row we are talking about?? The position is 0-based, so 0 is a good number. However, it should be changing as you click around on the grid.
P.S. You could subscribe to the BindingSource PositionChanged event just as an experiment to see what is happening to it as you do different things in the control.
hmm, your correct, I get the exact number (zero based), sorry for that.
The position changed gets executed, but then ..... Is there something I need to do to get the ttdoublesdb record to be found .... ?
No. Every time Position changes, the record in the buffer should change to match it. Are you not seeing that? Again, you could experiment with the PositionChanged event to see.
I think I found something, and it's logical.
It's a dialog form, and the temp-tables comes in as a parameter:
CONSTRUCTOR PUBLIC dgdoublesdb(INPUT M_type AS CHARACTER,
INPUT TABLE ttdoublesdb ):
So it's not available somewhere else. I'm new in .NET, what is the best way to pass a temp-table to a (dialog)-form ?
I think I've seen this behavior before. I'm trying to remember if it was the reason we started binding to a dataset instead of query.
Can you set the bindingsource handle to the temp-table or dataset handle instead of a query handle to see if the current record goes into scope?
You cannot bind to a temp-table. And you should NOT bind to a DataSet unless you want to see hierarchical data. If you are just binding to the data from one table, you should bind to a query just like he was doing..
Besides that, I don't understand the question. We are talking about ABL here. I.e., Your class dbdoublesdb is an ABL constructor. You pass temp-tables here the same way you pass them everywhere else. How is this related to your original problem?
Anyway, check your grid settings;
- DoubleClickRow event should fire unless you have an editor container embedded in the cell.
- AfterSelectChange event will not fire (so it will not put a record in scope) for some of the CellClickAction values. Try setting it to CellSelect.
I have been playing around with this, and I was passing the temp-table 'BY-REFERENCE'.
Not passing the temp-table BY-REFERENCE solves the problem.
When I pass the TT BY-REFERENCE, the records are available in the CONSTRUCTOR, but not in any other method.
So passing a temp-table to a Form, can't be passed BY-REFERENCE. I found that strange, but there must be a reason for that ....
Thanks for sharing.
Adding BIND to the input table, solved the problem.