progress / JSDO

Client side TypeScript library to access Progress® Data Object Services
Other
23 stars 27 forks source link

Add JSDO method which returns a list of all tables in the dataset specified by the JSDO object #233

Open hutcj opened 5 years ago

hutcj commented 5 years ago

I am implementing JSDO in an Angular project which consumes an OpenEdge PASOE API and displays data for CRUD operations to a web browser with Kendo UI. We have multiple datasets with 2+ tables in them. Does there exist a method or could one be created to enable the Angular developer to programmatically get and use a list of tables contained within the specified endpoint by the JSDO object?

edselg commented 5 years ago

Hello,

We currently do not have a method but it could be added for a future version.

I think that a way to do what you are looking for is to use the jsdo._buffers property. Please notice that this is an internal property and as any internal structure, it is reserved and could change if required.

The jsdo._buffers property points to the table references for the JSDO instance.

If you have a JSDO reference, then you can use Object.keys(jsdo._buffers) to query the tables for the JSDO.

Another alternative would be to work with the internal catalog structure.

Please let me know if this helps you.

hutcj commented 5 years ago

Thanks @edselg - I will give this a go! I had initially considered parsing out the catalog .json file manually with an HttpClient object for example, but this seemed like a bit of a hack job approach at best, since that would mean both the JSDO and my http object would interact directly with the service. This seems like a much better idea, even if it's using internal JSDO methods.