Commerce Server General - Howto Search PurchaseOrder WeaklyTyped Fields

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > September 2006 > Howto Search PurchaseOrder WeaklyTyped Fields





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Howto Search PurchaseOrder WeaklyTyped Fields
Johan Sorlin

2006-09-12, 1:21 pm

We have successfully added weakly typed fields to table PurchaseOrder in DB
and updated the .Xml files. The new fields is shown in the Order Manager
under Tab Advanced. So far so good.

But we want to search for the order(s) having specific values in our new
weakly typed fields. The Catalog can be searched using SQLWhereclause. Is
there a similar technic for PurchaseOrder. Looked into searchClause to be
used in PurchaseOrderManager.SearchPurchaseOrders (SearchClause,
SearchOptions) without an example.

Until now we get the ConnString(from profiles setting) and execute an
ordinary SQL question returning OrderGroupId and OrderId whith our SQL Where
set correct for our new fileds. Is there a better technic/choice?

Johan Sörlin, Sigma nBit, Sweden
Joseph Johnson

2006-09-12, 7:39 pm

Johan,

I would assume that using the SearchPurchaseOrders() method exposed by
the PurchaseOrderManager is the correct way of doing this, but I can't
seem to find a good example of this method being called, so some
clarification is probably required by MSFT on when to actually use this
method.

It doesn't appear to be part of the Runtime objects, so I think it's
probably designed to be used by one of the business UI apps or some
other web service method.

Joe


Johan Sorlin wrote:
> We have successfully added weakly typed fields to table PurchaseOrder in =

DB
> and updated the .Xml files. The new fields is shown in the Order Manager
> under Tab Advanced. So far so good.
>
> But we want to search for the order(s) having specific values in our new
> weakly typed fields. The Catalog can be searched using SQLWhereclause. Is
> there a similar technic for PurchaseOrder. Looked into searchClause to be
> used in PurchaseOrderManager.SearchPurchaseOrders (SearchClause,
> SearchOptions) without an example.
>
> Until now we get the ConnString(from profiles setting) and execute an
> ordinary SQL question returning OrderGroupId and OrderId whith our SQL W=

here
> set correct for our new fileds. Is there a better technic/choice?
>=20
> Johan S=F6rlin, Sigma nBit, Sweden


Laura T

2006-09-16, 7:28 pm

The CS2007 documentation says that if you use weakly-typed properties " you
cannot use Commerce Server's business user interface and Commerce Server's
APIs to search the properties in the database.".
LT


"Johan Sorlin" <JohanSorlin@discussions.microsoft.com> ha scritto nel
messaggio news:4F3132D0-9AC0-4FDB-AD4B-BBC59C17565A@microsoft.com...
> We have successfully added weakly typed fields to table PurchaseOrder in
> DB
> and updated the .Xml files. The new fields is shown in the Order Manager
> under Tab Advanced. So far so good.
>
> But we want to search for the order(s) having specific values in our new
> weakly typed fields. The Catalog can be searched using SQLWhereclause. Is
> there a similar technic for PurchaseOrder. Looked into searchClause to be
> used in PurchaseOrderManager.SearchPurchaseOrders (SearchClause,
> SearchOptions) without an example.
>
> Until now we get the ConnString(from profiles setting) and execute an
> ordinary SQL question returning OrderGroupId and OrderId whith our SQL
> Where
> set correct for our new fileds. Is there a better technic/choice?
>
> Johan Sörlin, Sigma nBit, Sweden



David Messner [MSFT]

2006-09-16, 7:28 pm

Laura is correct, if you wish to search on these columns you will need to
make them strongly typed properties and explicitly map them to columns in
the table.

Here is a code sample code for SearchPurchaseOrders

public void POSearchTest()
{
CSOrders.OrderServiceAgent agent = new
CSOrders.OrderServiceAgent("http://localhost/ordersWebservice/ordersWebservi
ce.asmx");
CSOrders.OrderManagementContext ordersContext =
CSOrders.OrderManagementContext.Create(agent);

DataSet searchableEntities =
ordersContext.PurchaseOrderManager.GetSearchableProperties(CultureInfo.Curre
ntUICulture.ToString());
// DumpDataSet(searchableEntities);

SearchClause clause =
ordersContext.PurchaseOrderManager. GetSearchClauseFactory(searchableEntitie
s
, "PurchaseOrder").CreateClause(ExplicitComparisonOperator.Equal, "Status",
"New Order");
DataSet searchResults =
ordersContext.PurchaseOrderManager.SearchPurchaseOrders(clause);
// DumpDataSet(searchResults);

List<Guid> purchaseOrderIds = new List<Guid>();
DataTable dt = searchResults.Tables[0];
foreach(DataRow dr in dt.Rows)
{
purchaseOrderIds.Add(new Guid(dr[0].ToString()));
}

XmlElement poXml =
ordersContext.PurchaseOrderManager.GetPurchaseOrdersAsXml(purchaseOrderIds.T
oArray());
Debug.WriteLine(poXml.OuterXml);
}

--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2006 Microsoft Corporation. All rights
reserved.

--------------------
From: "Laura T" <laura.t@_yahoo.com>
References: <4F3132D0-9AC0-4FDB-AD4B-BBC59C17565A@microsoft.com>
Subject: Re: Howto Search PurchaseOrder WeaklyTyped Fields
Date: Wed, 13 Sep 2006 12:56:33 +0200

The CS2007 documentation says that if you use weakly-typed properties " you
cannot use Commerce Server's business user interface and Commerce Server's
APIs to search the properties in the database.".
LT


"Johan Sorlin" <JohanSorlin@discussions.microsoft.com> ha scritto nel
messaggio news:4F3132D0-9AC0-4FDB-AD4B-BBC59C17565A@microsoft.com...
> We have successfully added weakly typed fields to table PurchaseOrder in
> DB
> and updated the .Xml files. The new fields is shown in the Order Manager
> under Tab Advanced. So far so good.
>
> But we want to search for the order(s) having specific values in our new
> weakly typed fields. The Catalog can be searched using SQLWhereclause. Is
> there a similar technic for PurchaseOrder. Looked into searchClause to be
> used in PurchaseOrderManager.SearchPurchaseOrders (SearchClause,
> SearchOptions) without an example.
>
> Until now we get the ConnString(from profiles setting) and execute an
> ordinary SQL question returning OrderGroupId and OrderId whith our SQL
> Where
> set correct for our new fileds. Is there a better technic/choice?
>
> Johan Sörlin, Sigma nBit, Sweden




Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com