progress / JSDO

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

Cannot create property 'tableRef' on string '{"ablFilter": ... #253

Open mdossant opened 5 years ago

mdossant commented 5 years ago

Not sure if this is related to issue #234. I get the error below:

Cannot create property 'tableRef' on string '{"ablFilter":"SalesRep = \"KIK\"","orderBy":"Name","top":2,"skip":0}'

It comes from this file / line: @progress/jsdo-angular/lib/progress.data.angular.js

line 271:

    // tableRef required for multi-table DataSets
    if (filter) {
        filter.tableRef = this._tableRef;
    }

If I comment those 3 lines then it works. This works in version 5 but fails like that in version 6.

mdossant commented 5 years ago

Again, it's the same source code that works in 5 but fails in 6. Perhaps tableRef is not supported anymore or I need to set it differently? This is how I create the JSDO:

        const jsdo = new progressCore.progress.data.JSDO({
            name: 'SalesReps'
        });

new ngDataSource.DataSource({ jsdo: jsdo, tableRef: 'ttSalesRep' });

joshualan commented 5 years ago

I think we removed that in JSDO 6.0, could you give your use case for it so we can figure out your next steps?

mdossant commented 5 years ago

Hi Alan,

This is the way I've always used JSDO's by setting tableRef to the business entity's temp-table -- it works in 5.0 in various live apps. I tried not setting it for 6.0 and still got the same error. More importantly, if this has been removed in JSDO 6.0 then what about lines 269 thru 272 below as mentioned before? It seems the JSDO 6 still tries to do something with tableRef.

@progress/jsdo-angular/lib/progress.data.angular.js

// tableRef required for multi-table DataSets
if (filter) {
    filter.tableRef = this._tableRef;
}

Also, I'm not really using multi table dataset. Is there a different way of creating a JSDO without tableRef or am I passing the wrong properties to it? Any help will be greatly appreciated. This is my source code where I create the JSDO and datasource and read data -- again works in 5 not 6:

const progressCore = require('@progress/jsdo-core'); const ngDataSource = require('@progress/jsdo-angular'); ... // calculate/set filter variables based on user input ... progressCore.progress.data.getSession({ name: 'sportsflex', serviceURI: serviceURI, catalogURI: catalogURI, authenticationModel: progressCore.progress.data.Session.AUTH_TYPE_BASIC, username: username, password: password, }).then(()=>{ const jsdo = new progressCore.progress.data.JSDO({ name: 'SalesReps' }); const ds = new ngDataSource.DataSource({ jsdo: jsdo, tableRef: 'ttSalesRep' }); return ds.read( filter=JSON.stringify({ ablFilter: ablFilter, orderBy: orderBy, top: top, skip: skip }) ).toPromise(); }).then((response) => { console.log('number of records retrieved',response.data.length); complete().setBody(JSON.stringify(response.data)).ok().next(); }).catch((err) => { console.log('err.message',err.message); console.log('err.stack',err.stack); complete(err).runtimeError().next(); }); }

This is my config so you can check the versions on dependencies:

{ "name": "sportsflex", "version": "1.0.25", "description": "A kinvey flex jsdo connector for sports app", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Mauricio dos Santos", "license": "ISC", "dependencies": { "@angular/core": "^5.2.1", "@progress/jsdo-angular": "^6.0.0", "@progress/jsdo-core": "^6.0.0", "base-64": "^0.1.0", "kinvey-flex-sdk": "^3.1.2", "node-localstorage": "^1.3.1", "rxjs": "^6.4.0", "rxjs-compat": "^6.4.0", "xmlhttprequest": "^1.8.0" } }

Thanks,

Mauricio

zerovian commented 5 years ago

Internal issue number: OCTA-13388

joshualan commented 5 years ago

@mdossant goal is to be fixing this this week