Developer forum

Forum » Development » OrderCollection Load obsolete

OrderCollection Load obsolete

Jesse Bakker
Reply

Hi, 

We have some code that gets orders based on a sql query. We used it for getting orders by date, customernumber or other customfields. 

var orders = new OrderCollection();
orders.Load(sqlQuery);

But after upgrading to 9.6.9 (from 9.3) the OrderCollection is marked as obsolete. And the Load() throws an null reference exception.

Is there a replacement for getting orders based on a custom sql query?

 

 

 


Replies

 
Jesse Bakker
Reply

Hi,

The null reference exception that was thrown on getting orders was caused by empty OrderCurrencyCode columns.
It was thrown on all methodes on OrderService to get orders. So that was fixable by setting the column directly in the database on existing orders.

So for now we stick with the obsolete method. But it would be nice to have a GetBySql method on the OrderService in the future.

 
Nicolai Pedersen
Reply

Hi Jesse

Thanks for the update - I have asked to fix the API issue.I agree it is a bit of a mess.

Out of curiosity - how did you get empty currency columns? From an import or from orders made by DW?

BR Nicolai

 
Jesse Bakker
Reply

Hi Nicolai,

It was because of orders created from custom code. That code wasn't adding the currency.  

Thanks for fixing the API.

 

You must be logged in to post in the forum