Is there a good approach to defining temp-table/prodataset a

Posted by jquerijero on 20-Jun-2019 18:06

I'm wondering if there is a way to incorporate temp-table/prodataset as a property to a class, specially when creating System.EventArgs derived class, or at least something that will achieve the same effect like maybe a method with INPUT-OUTPUT parameter. 

Thanks,

All Replies

Posted by Thomas Mercer-Hursh on 20-Jun-2019 18:22

Wouldn't this be violating a basic tenet of OO design by making the implementation visible outside of the class?

Posted by jquerijero on 20-Jun-2019 18:42

That is very much true for full-pledge object that wraps a temp-table, or a collection that wraps a prodataset. But there are cases where the temp-table is just data, and as for EventArgs, it is very likely that the mutation to its properties --- outside of initialization --- will be handled by the consuming class or object anyways.

Posted by Peter Judge on 20-Jun-2019 20:02

You can't define property as a temp-table or dataset type, nor can you define a temp-table/dataset as public in a class.
 
You'll have to either
                - expose it as a handle
                - return it as an output parameter in a method
                - add read/write methods to expose certain aspects of data
                - ugly: define a JsonObject property with getter and setter methods that READ-JSON and WRITE-JSON
 
Those are the approaches off the top of my head. There will be others, but the moral of the story is that there's no easy/pretty/good way of doing this yet.
 
-- peter
 

Posted by jquerijero on 20-Jun-2019 20:08

Thanks,

While we're in this topic, will there be an equivalent tool like in Visual Studio that generates a custom class based on a temp-table or prodataset? I think that will be a helpful tool for writing model.

[quote user="Peter Judge"]

You can't define property as a temp-table or dataset type, nor can you define a temp-table/dataset as public in a class.
 
You'll have to either
                - expose it as a handle
                - return it as an output parameter in a method
                - add read/write methods to expose certain aspects of data
                - ugly: define a JsonObject property with getter and setter methods that READ-JSON and WRITE-JSON
 
Those are the approaches off the top of my head. There will be others, but the moral of the story is that there's no easy/pretty/good way of doing this yet.
 
-- peter
 

[/quote]

Posted by goo on 20-Jun-2019 20:16

Peter, why is JsonObject getter ugly? I just made a class that adds kind of name and value records to a template, and since I needed it as json, I made a jsonobject getter. Works swell, but now i am kind of curious of what ugly code that is?


I always want to learn so keep on the good work :-)

Sendt fra min iPad

20. jun. 2019 kl. 22:03 skrev Peter Judge <bounce-pjudge@community.progress.com>:

Update from Progress Community
<4TW97ZQFKRYJ-jpg_2D00_70x70x2-jpg>
Peter Judge

You can't define property as a temp-table or dataset type, nor can you define a temp-table/dataset as public in a class.
 
You'll have to either
                - expose it as a handle
                - return it as an output parameter in a method
                - add read/write methods to expose certain aspects of data
                - ugly: define a JsonObject property with getter and setter methods that READ-JSON and WRITE-JSON
 
Those are the approaches off the top of my head. There will be others, but the moral of the story is that there's no easy/pretty/good way of doing this yet.
 
-- peter
 

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

Posted by Peter Judge on 20-Jun-2019 20:22

Only ugly in the sense that you have to convert TT <-> JsonObject whenever you want to read or write the data in the TT. It's also easier to get a field from a TT than it is from Json (in ABL).
 
Maybe "ugly" here also means "relatively slow" because of the conversion.
 
 
 

Posted by Peter Judge on 20-Jun-2019 20:26

> While we're in this topic, will there be an equivalent tool like in Visual Studio that generates a custom class based on a temp-table or
> prodataset? I think that will be a helpful tool for writing model.

Something along the lines of a tool that takes a (db or TT) schema and (basically) creates an ActiveRecord representation of it? I don't know whether that (or anything that's close to an ORM) would be the best "ABL way" of approaching strongly-typed data.

 

What are you trying to do with this object? There are ways - a handle-wrapper object being the simplest - of getting a TT/PDS in an OO-passable state. Are you just looking to give access to that TT data to another instance?

 

 
 
 

Posted by jquerijero on 20-Jun-2019 20:49

>> Something along the lines of a tool that takes a (db or TT) schema and (basically) creates an ActiveRecord representation of it? I don't know whether that (or anything that's close to an ORM) would be the best "ABL way" of approaching strongly-typed data.

Visual Studio has a tool to generate a System.Dataset derived class from a database table schema.

>> What are you trying to do with this object? There are ways - a handle-wrapper object being the simplest - of getting a TT/PDS in an OO-passable state. Are you just looking to give access to that TT data to another instance?

Yes

Posted by Mike Fechner on 20-Jun-2019 21:02

We have tooling for that purpose. Let me know if you are interested in a demo or discussion.

Sent from Nine

Von: jquerijero <bounce-jquerijero@community.progress.com>
Gesendet: Donnerstag, 20. Juni 2019 22:51
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] Is there a good approach to defining temp-table/prodataset as class property?

Update from Progress Community
jquerijero

>> Something along the lines of a tool that takes a (db or TT) schema and (basically) creates an ActiveRecord representation of it? I don't know whether that (or anything that's close to an ORM) would be the best "ABL way" of approaching strongly-typed data.

Visual Studio has a tool to generate a System.Dataset derived class from a database table schema.

>> What are you trying to do with this object? There are ways - a handle-wrapper object being the simplest - of getting a TT/PDS in an OO-passable state. Are you just looking to give access to that TT data to another instance?

Yes

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

Posted by mollyfed on 21-Jun-2019 00:55

Before Progress spent time building a class from a Dataset would rather they take one of the tools that does mapping from one thing to another in Eclipse and plug that on the front of a tool for mapping JSON (and maybe XML) to a Dataset/Temp-table and then produce a class to convert the data coming in. I say this for the JSON/XML that is too complex for READ-JSON/XML to understand (aka heavy nesting).

JMTC

Posted by Patrick Tingen on 21-Jun-2019 06:34

The DataDigger can do exactly that, only for database tables, not TT's. Check the blog for more info and download option (DataDigger is free and open source). It has some options to generate code. Currently, those are:

  • Active record class
  • Assign statement
  • Dump/Load procedure
  • TempTable include

There is also an option to add custom export procedures, should you find the need for something that is not yet provided. Detailed instructions are available in DD itself and on the DataDigger wiki

Posted by Peter Judge on 21-Jun-2019 15:24

For the former, there's a tool in the data dictionary  to generate an include with a temp-table definition. Datasets would need relationship information which is not in the db schema.
 
Or you can use LIKE for temp-table definitons.
 

Posted by Mike Fechner on 21-Jun-2019 15:28

Peter, I’m going to quote you on the LIKE … (99 web handlers ought to be enough for everyone).
 
It’s really a bad practice, to tie anything that might appear in an Interface (temp-table) to an implementation detail (database schema).
 
 
 
 
Von: Peter Judge <bounce-pjudge@community.progress.com>
Gesendet: Freitag, 21. Juni 2019 17:26
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] Is there a good approach to defining temp-table/prodataset as class property?
 
Update from Progress Community
 
For the former, there's a tool in the data dictionary  to generate an include with a temp-table definition. Datasets would need relationship information which is not in the db schema.
 
Or you can use LIKE for temp-table definitons.
 

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

 

Posted by Peter Judge on 21-Jun-2019 15:34

I agree on the "bad LIKE" … I realised I should have not suggested after I sent it.
 
Note that it is in upper case though … ;)
 

This thread is closed