jaydata icon indicating copy to clipboard operation
jaydata copied to clipboard

OData != null filter Issue

Open kevinolorenzo opened this issue 11 years ago • 5 comments

I am currently using jayData 1.3.1 and typescript 0.9.1. I have a web api service that I have configured for odata. In my typescript that has a filter as follows filter(il => il.Item != null && il.Invoice != null) when the jaydata creates the query string it is placing a / after the property (i.e. ((Item/ neq null) && (Invoice neq null))

I fixed this issue by altering the jayData oDataProvider.js file on line 1514 in the else of the VisitSimpleBinaryExpression by adding the following after the Visit function: if (context.data != null && context.data.lastIndexOf("/") === context.data.length - 1) { context.data = context.data.substring(0, context.data.length - 1) }

I'm not sure if this a bug or if I was doing the query in typescript improperly but thought I would post my fix just in case.

Thanks

kevinolorenzo avatar Jul 03 '13 18:07 kevinolorenzo

Hello @kevinolorenzo , thanks for your feedback, be check this!

robesz avatar Jul 04 '13 06:07 robesz

Hi,

We added TypeScript 0.9.x support to JaySvcUtil 1.3.1 (non-beta). You can get the latest version here: http://jaydata.org/download

The package contains the latest jaydata.d.ts, use this in your project and re-generate your model definition using the new JaySvcUtil.

Please confirm that the TypeScript 0.9 support in the new version fixes your issue. Thanks

robesz avatar Jul 05 '13 13:07 robesz

Hi,

The issue still occurs.

On Fri, Jul 5, 2013 at 9:41 AM, Robert Bonay [email protected]:

Hi,

We added TypeScript 0.9.x support to JaySvcUtil 1.3.1 (non-beta). You can get the latest version here: http://jaydata.org/download

The package contains the latest jaydata.d.ts, use this in your project and re-generate your model definition using the new JaySvcUtil.

Please confirm that the TypeScript 0.9 support in the new version fixes your issue. Thanks

— Reply to this email directly or view it on GitHubhttps://github.com/jaydata/jaydata/issues/108#issuecomment-20519391 .

kevinolorenzo avatar Jul 06 '13 04:07 kevinolorenzo

Hello Sir, could you please share your entity model (at least the relevant entity)? Both js and d.ts would be great. This way we could see the types of the field used in the query. Is this the only failing query? Thanks, Rob

robesz avatar Jul 10 '13 10:07 robesz

Hi Rob,

I have included the entities model and provider/content typescript and javascript files. I have also attached the alteration I made to fix the issue in the oDataProvider.js on line 1514 marked with ///KLW. Just as extra information I am using datajs-1.1.1beta2.js along side this as well as angularjs to inject the provider/context although I don't believe that to be an issue. The piece of typescript code that is causing the offense is below. It is the only query I currently have in the web app. The url is resolving as follows without my fix: http://localhost:2351/amtechcs/servtracweb/dataservice/InvoiceLines?$filter=((Invoice/%20ne%20null)%20and%20(Invoice/Customer/%20ne%20null))&$expand=Invoice,Invoice/BillingRegion,Invoice/Customer,Invoice/ShippingStatusCode,Invoice/ShippingTerm,PurchaseOrderLine,PurchaseOrderLine/PurchaseOrder,PurchaseOrderLine/PurchaseOrder/Addresses&$inlinecount=allpages&$top=50

var _baseServiceUrl: string = "/amtechcs/servtracweb"; var sourceOptions: kendo.data.DataSourceOptions = { pageSize: 50, serverPaging: false, //ignored by jaydata requestStart: (e: kendo.data.DataSourceRequestStartEvent) => { this._viewModel.isBusy = true; }, requestEnd: (e: kendo.data.DataSourceRequestEndEvent) => { this._viewModel.isBusy = false; }

var _entityProvider.= new Amtech.ServtracWeb.Providers.ServtracEntityProvider({ name: "oData", maxDataServiceVersion: "3.0", oDataServiceHost: this._baseServiceUrl + "/dataservice" });

            this._viewModel.dataGridOptions.dataSource =

_entityProvider.InvoiceLines .filter(function (l) { return l.Invoice != null && l.Invoice.Customer != null) .include("Invoice") .include("Invoice.BillingRegion") .include("Invoice.Customer") .include("Invoice.ShippingStatusCode") .include("Invoice.ShippingTerm") .include("PurchaseOrderLine") .include("PurchaseOrderLine.PurchaseOrder") .include("PurchaseOrderLine.PurchaseOrder.Addresses") .asKendoDataSource(sourceOptions);

Please let me know if you need anything further.

On Wed, Jul 10, 2013 at 6:51 AM, Robert Bonay [email protected]:

Hello Sir, could you please share your entity model (at least the relevant entity)? Both js and d.ts would be great. This way we could see the types of the field used in the query. Is this the only failing query? Thanks, Rob

— Reply to this email directly or view it on GitHubhttps://github.com/jaydata/jaydata/issues/108#issuecomment-20734584 .

kevinolorenzo avatar Jul 10 '13 13:07 kevinolorenzo