TEMP-TABLE vs "TableDesc"

Posted by jmls on 26-Jul-2008 14:43

Playing around with the ProDatabinding Designer, I see stuff in the code that refers to a "tableDesc" thingy.

tableDesc1 = NEW Progress.Data.TableDesc("Menu")

and

arrayvar0[1] = NEW Progress.Data.ColumnPropDesc("MenuName", "Menu", Progress.Data.DataType:CHARACTER).

(Menu is a table that I created in the Designer, with MenuName as a field)

Now, is there any relation between this "thingy" and a temp-table ? How can I populate this ? Or is it a placeholder for a db / temp-table record ?

All Replies

Posted by Admin on 26-Jul-2008 17:27

It's a place holder for the schema of a progress data source (temp-table, prodataset, db query).

The ProBindingSource will only know at runtime the schema of your data source. To enable the visual design including data binding properties, some schema representation is required. Also if you open a query very late (i.e. when the user presses a search button), but you want to see the grid column when the form is launched.

Posted by jmls on 27-Jul-2008 04:35

So, do I create the "placeholder" schema at design time, and then attach the "real" schema at runtime ? If this is the case, I presume that the temp-table name and fields must match the placeholder name and fields

Posted by Admin on 27-Jul-2008 04:39

Exactly. I would assume the datatype as well.

What happens, when you have a mismatch in those names is, that during runtime the binding source will offer fields to the visual controls that they don't expect.

The ultragrid will just display them - but they are unformatted as you had no chance to format them in the VD. Other controls like textboxes will perform unbound as the field they have been told to bind to does not exists.

Posted by jmls on 27-Jul-2008 04:42

Mike, this may be a little cheeky, but do you have some example code of how you attach the temp-table to the datasource after designing it in the builder ?

I need a step-up, it's early Sunday morning and the red wine last night did not help one little bit

Thanks ...

Posted by Admin on 27-Jul-2008 05:47

That's rather simple: The VD creates an instance named bindingSource1 and you just assign the handle property:

bindingSource1:HANDLE = TEMP-TABLE ttJulian:HANDLE .

Or use a query:

bindingSource1:HANDLE = QUERY q:HANDLE .

Posted by jmls on 27-Jul-2008 05:57

So simple, I missed it. Thanks very much!

Posted by jmls on 27-Jul-2008 08:00

okies, I came across an issue here, and want to know if it's a bug or not.

using your example,

bindingSource1:HANDLE = TEMP-TABLE ttJulian:HANDLE .

compiles ok, but gives me a run-time error

"System.Exceptin: invalid handle specified for the bindingsource's property"

however, if I change the code to

def dataset foo for ttjulian.

bindingSource1:HANDLE = dataset foo:HANDLE .

it all works ok.

Is this a bug, or not ?

Posted by sarahm on 30-Jul-2008 07:45

Julian, this is not a bug. The bindingsource object can be bound to a dataset, query or buffer, but not a temp-table. I hope that helps.

sarah

Posted by jmls on 30-Jul-2008 07:51

Yeah, a few days later things make more sense.

This thread is closed