tableRef is being ignored in JSDO for Angular 6

Posted by christian.bryan@capita.co.uk on 07-Feb-2019 15:18

HI 

We have noticed that even though we supply a tableRef property to a DataSource object in our Angular application the JSDO does not add the tableRef into the filter when calling the count invoke or the read / get.

This causes incorrect results or errors for BE's which have multiple tables.

Code example

We are using the JSDO version 6 for Angular with Angular 6.

PS - If you do the above using a Jquery implementation of the JSDO it adds tableRef to the filter.

Thanks

Christian.

 

All Replies

Posted by egarcia on 07-Feb-2019 19:15

Hello Christian,

Thank you for reporting the issue via GitHub:

- github.com/.../234

We will take a look and let you know our findings.

Thank you and regards,

Edsel

Posted by christian.bryan@capita.co.uk on 09-Feb-2019 17:22

Hi Edsel

The tableref being passed on the URL seems to have been removed from JSDO 4.2 onwards in both Angular and Jquery versions.

I am looking to debug why.

Thanks

Christian.

Posted by christian.bryan@capita.co.uk on 10-Feb-2019 18:59

Hi Edsel

It looks like an addition by Mike Fechner made in JSDO 4.2 on 16.03.2016 has been lost in future JSDO versions.

Can we get this change added back into the JSDO?

Its in the request mapping function (See lines annotated with CJB:

// Christian Bryan - 10.02.2019 Add this back in

// Mike Fechner, Consultingwerk Ltd. 16.03.2016

               // Adding the tableRef property of the JSDO Parameters to

               // the Filter Parameter so that the backend can use this

               // information to actually know which Business Entity Table

               // the query filter string is intended for ...

filter = JSON.stringify({

ablFilter: ablFilter,

tableRef: params.tableRef, // CJB

       viewTables: jsdo.viewTables, // CJB

                                       sqlQuery: sqlQuery,

orderBy: sortFields,

skip: params.skip,

top: params.top

});

Thanks

Christian.

Posted by Mike Fechner on 11-Feb-2019 10:26

I don't think this has ever been merged into the Standard Progress JSDO code line. As a matter of fact, we have re-applied this custimization to the JSDO 6.0 in our repo. I don't think we can just issue a pull request - due to a different build script we've been using.

But you may have a look at our JSDO repo.

Posted by egarcia on 11-Feb-2019 11:57

Hello Christian,

Thank you for the debugging.

The enhancement with viewTables was not not submitted to the JSDO repo as a PR.

@Mike

Do you think that it would be possible to submit a PR to the develop branch, perhaps, not from your main branch but one that just provides the require update?

Is it just to add tableRef and viewTables to the call?

Please let me know.

Thank you and regards,

Edsel

Posted by christian.bryan@capita.co.uk on 11-Feb-2019 15:10

HI Guys

From my point of view i would like tableRef and possibly viewTables added into the JSDO and in particular the JSDO for Angular asap as we need them for our current development project.

Thanks

Christian.

Posted by Patrik Wikström on 12-Feb-2019 05:24

We also think viewTables functionality should be added to the standard JSO.

Br,

Patrik

Posted by rnicoara on 12-Feb-2019 07:44

Hello,

I'm afraid we're unable to issue a pull request which only includes that specific update, as that change was not an isolated commit.

@Christian, since it is a small change, perhaps you could issue the PR? Alternatively you could use our version of the JSDO core and angular packages.

Regards,

Radu Nicoara

Posted by rnicoara on 12-Feb-2019 09:52

Since we’re discussing the tableRef and viewTable settings, it might also be worth mentioning that our Angular data source implementation also supports working with a subset of the ProDataSet, by means of a “partialDataSet” setting. For example, when working with something like:

eOrder -> eCustomer

eOrder -> eOrderLine

eOrderLine -> eItem

We can use two different JSDO configurations:

tableRef = eOrder, viewTables = eCustomer and

tableRef = eOrderLine, viewTabels = eItem

It follows the MVVM pattern, in that the backend uses a model optimised for the business logic and the client adopts different “views”, depending on what is needed for the use case.

However, this is handled by our data source and not our version of the JSDO.

I believe that support for scenarios like this would also be a great addition to the JSDO.

Posted by christian.bryan@capita.co.uk on 13-Feb-2019 08:31

Hi Radu

How do i go about doing the PR?

Thanks

Posted by rnicoara on 13-Feb-2019 09:09

Hi Christian,

I believe Edsel would be better qualified to answer that question.

Posted by christian.bryan@capita.co.uk on 13-Feb-2019 09:56

HI Radu

How would we go about using your implementation of the JSDO for angular?

Thanks

Christian.

Posted by rnicoara on 13-Feb-2019 11:41

Hi Christian,

To use our implementation of the JSDO, please follow these steps:

- uninstall @progress/jsdo-core and @progress/jsdo-angular

- run the following command in the root of your project: "npm install --save @consultingwerk/smartcomponents-jsdo-core @consultingwerk/smartcomponents-jsdo-angular --registry npm.consultingwerkcloud.com"

- in your code, replace all imports from "@progress/jsdo-core" to "@consultingwerk/smartcomponents-jsdo-core" and from "@progress/jsdo-angular" to "@consultingwerk/smartcomponents-jsdo-angular"

The rest of your existing code should work as is.

You might also be interested in looking into our Smart Data Source, which makes tasks such as performing a named query quite easy. Since you have licensed the SmartComponent Library, I can also give you access to that.

This thread is closed