London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
If I recall correctly you can do something like:
searchOptions.Classes.Add("OrderFormEx");
Hi Juan,
The where clause should go like this.
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("WHERE OrderFormEx.MyField = " + DataToFind+ " )");
You have to modify query as following:
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("OrderGroupId IN (SELECT li.OrderGroupId From LineItem li ");
sqlQuery.Append("INNER JOIN LineItemEx ex ");
sqlQuery.Append("ON li.LineItemId = ex.ObjectId ");
sqlQuery.Append("INNER JOIN Shipment sh ");
sqlQuery.Append("ON li.OrderGroupId = sh.OrderGroupId ");
sqlQuery.Append("INNER JOIN ShipmentEx shex ");
sqlQuery.Append("ON sh.ShipmentId = shex.ObjectId ");
sqlQuery.Append("WHERE ex.ExpirationDate > '1/1/2011'");
sqlQuery.Append("AND NOT shex.PrevStatus IS NULL)");
OrderSearchParameters parameters = new OrderSearchParameters();
searchOptions.Classes.Add("PurchaseOrder");
parameters.SqlMetaWhereClause = "";
parameters.SqlWhereClause = sqlQuery.ToString();
PurchaseOrder[] purchaseOrderCollection = OrderContext.Current.FindPurchaseOrders(parameters, searchOptions);
Hi
I trying to create a SQL query that I can execute with
var searchOptions = new OrderSearchOptions { CacheResults = false, StartingRecord = 0, RecordsToRetrieve = 10000, Namespace = OrderNamespace.OrdersNamespace }; var parameters = new OrderSearchParameters(); var sqlQueryFilter = new StringBuilder(); sqlQueryFilter.Append("OrderGroupId IN (SELECT ObjectId From OrderFormEx "); sqlQueryFilter.AppendFormat("WHERE OrderFormEx.MyField = '{0}' )", DataToFind); parameters.SqlWhereClause = sqlQueryFilter.ToString(); OrderContext.Current.Search<PurchaseOrder>(parameters, options);
I need to query also a field in OrderFormEx.
Any idea how to create the sqlQueryFilter?
Thanks