|
Home > Archive > Commerce Server General > March 2005 > Parsing Marshaled data
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 |
Parsing Marshaled data
|
|
| rixmann 2005-03-17, 5:53 pm |
| Beating a dead horse I know...
I have a requirement to produce reports based on data that is currently
stored in the marshaled_data field (OrderGroup and OrderFormLineItem).
I have created the new columns in each of the tables so that CS now
writes the values to those fields. The issue is the historical data and
how do I get the data from the marshaled_data field into the newly
created columns.
There are a few options with respect to this:
1. Create a utility that reads the marshaled_data and writes the data
to the appropriate fields using SQL. This option is my favorite but
I've been able to determine how to CAST the data that is coming from
the marshaled_data field.
2. Create a utility that uses the CS objects to read the data and then
write the data (as option 1). This option in theory should work but I'm
having difficulty creating the appropriate context so that I can access
the CS objects through this utility.
3. Within the web-app, when the report is requested, access the CS
objects and write the data then.
I would prefer to be able to do option 1 as it should be relatively
simple:
for each PO_number
for each line_item
read the marshaled_data
x = cast(marshaled_data as BinaryXMLObjectOfSomeSort)
write x.values to dbase
next
next
I would appreciate any help with this. Thanks.
| |
| Ravi Shankar 2005-03-18, 2:46 am |
| Since you've already extended the database schema, optiontwo would be the
quickest. All you need to do is loop on dates to get a list of all the
orders, load each order using the "purchase order" object and save it back
into the database. Since the schema has been extended, the save operation
would cause the data in marshalled_data column to get persisted into the
fields 
The code would look something like
Imports Microsoft.CommerceServer.Runtime
Imports Microsoft.CommerceServer.Runtime.Diagnostics
Imports Microsoft.CommerceServer.Runtime.Orders
Dim oCRC as CommerceResourceCollection
Dim oTR as CommerceResource
Dim oOC as OrderContext
Dim oCDC as ConsoleDebugContext
Dim sTransactionConnStr as String
oCRC = new CommerceResourceCollection("<sitename>")
oTR = oCRC.Item("Transactions")
sTransactionConnStr = oTR.Item("connstr_db_Transactions")
oCDC = new ConsoleDebugContext(Consloe.Debug)
oOC = new OrderContext(sTransactionConnStr, oCDC)
' --- <phew> now onto pseudocode
Create OrderSearchOptions object
Set properties such as "Start Date", "End Date", Order Date Field -
"order_create_date"
Perform Search on Orders to get a RecordSet
for each record in the resultset
read the User ID
read the OrderGroup ID
Load the Purchase Order
Save the Purchase Order
next
'
' Close/Dispose all contexts.
'---- And You're done.
Hope this helps.
"rixmann" wrote:
> Beating a dead horse I know...
>
> I have a requirement to produce reports based on data that is currently
> stored in the marshaled_data field (OrderGroup and OrderFormLineItem).
> I have created the new columns in each of the tables so that CS now
> writes the values to those fields. The issue is the historical data and
> how do I get the data from the marshaled_data field into the newly
> created columns.
>
> There are a few options with respect to this:
> 1. Create a utility that reads the marshaled_data and writes the data
> to the appropriate fields using SQL. This option is my favorite but
> I've been able to determine how to CAST the data that is coming from
> the marshaled_data field.
>
> 2. Create a utility that uses the CS objects to read the data and then
> write the data (as option 1). This option in theory should work but I'm
> having difficulty creating the appropriate context so that I can access
> the CS objects through this utility.
>
> 3. Within the web-app, when the report is requested, access the CS
> objects and write the data then.
>
> I would prefer to be able to do option 1 as it should be relatively
> simple:
>
> for each PO_number
> for each line_item
> read the marshaled_data
> x = cast(marshaled_data as BinaryXMLObjectOfSomeSort)
> write x.values to dbase
> next
> next
>
> I would appreciate any help with this. Thanks.
>
>
| |
| memnoch 2005-03-30, 12:31 am |
| Hi, I have a similar problem where I need to export data being stored in as marshaled data in the ordergroupaddress table.
Is there any other way to extract the data other than redefining the schema? (ie any tool or code that would allow me to this?)
Thanks. | |
| Ravi Shankar 2005-03-30, 5:51 pm |
| You can always use code to extract/parse data..
Identify the PurchaseOrders in question using the Search object on the
OrderContext object. Load each of the purchaseOrders and parse the addresses
collection to get the shipping & billing addresses.... then you can pretty
much pick up whatever fields you want and write them wherever you want...
If you want them for reporting purposeses then define all this as a VBS
script and execute it as a ActiveX Task in DTS to populate the DWH and query
away.
"memnoch" wrote:
>
> Hi, I have a similar problem where I need to export data being stored in
> as marshaled data in the ordergroupaddress table.
> Is there any other way to extract the data other than redefining the
> schema? (ie any tool or code that would allow me to this?)
>
> Thanks.
>
>
>
> --
> memnoch
> ------------------------------------------------------------------------
> Posted via http://www.webservertalk.com
> ------------------------------------------------------------------------
> View this thread: http://www.webservertalk.com/message960427.html
>
>
|
|
|
|
|