|
Home > Archive > Commerce Server General > May 2004 > DataFunctions
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]
|
|
| Ravi Shankar 2004-05-05, 1:35 am |
| The context is built up prior to the call to the
pipeline. You should add the DataFunctions to the context
there.
HTH
>-----Original Message-----
>Hmm, I thought the context was passed in
automatically...how can I
>pass it in then?
>
>-Ryan
>
>
>
>Pipeline Error: Component Execution failed for component
[0x3] hr:
>0x80020101
>ProgID: Commerce.Scriptor.1
>MscsExecute() failed.
>Script invocation failed.
>Object required: 'context.dataFunctions'
>Line: 7.
>
>
#: " & _[vbcol=seagreen]
chr(13) & _[vbcol=seagreen]
(10) & chr(13) & _[vbcol=seagreen]
(orderform.[date_changed]) & _[vbcol=seagreen]
[_cy_total_total])) & _[vbcol=seagreen]
& chr(10) & chr(13)[vbcol=seagreen]
& #91;shipping_address_id][vbcol=seagreen]
[Addresses]. Value(shippingAddressId)[vbcol=seagreen]
orderform.[shipping method] & _[vbcol=seagreen]
shippingAddress.[address_name] & chr(10) & chr(13) & _[vbcol=seagreen]
[address_line1] & chr(10) & chr(13)[vbcol=seagreen]
[address2]) > 0 Then _[vbcol=seagreen]
& shippingAddress.[address2_line2] & chr(10) & chr(13)[vbcol=seagreen]
shippingAddress.[city] & ", " & _[vbcol=seagreen]
[region_code] & " " & shippingAddress[postal_code] & _[vbcol=seagreen]
(10) & chr(13)[vbcol=seagreen]
>.
>
| |
| ryanr@nni.com 2004-05-05, 3:36 pm |
| Right.
And as Retail2002 uses Global.asax files...Should I declare a
DataFunctions object before calling the pipeline, or add it to the
overall class? (as per MSDN):
Public Class Retail2002
Inherits CommerceApplication
End Class
Additionally, you say the context is built up prior to the call. Will
the context grab from the application (do the above, forget about
everything else), or do I need to modify it (pipeline, context)
somehow?
Thanks,
Ryan
On Tue, 4 May 2004 21:58:10 -0700, "Ravi Shankar"
<shankar.nospam@hp.com> wrote:
[vbcol=seagreen]
>The context is built up prior to the call to the
>pipeline. You should add the DataFunctions to the context
>there.
>
>HTH
>automatically...how can I
>[0x3] hr:
>#: " & _
>chr(13) & _
>(10) & chr(13) & _
>(orderform.[date_changed]) & _
>[_cy_total_total])) & _
>& chr(10) & chr(13)
>[shipping_address_id]
>[Addresses].Value(shippingAddressId)
>orderform.[shipping method] & _
>shippingAddress.[address_name] & chr(10) & chr(13) & _
>[address_line1] & chr(10) & chr(13)
>[address2]) > 0 Then _
>& shippingAddress.[address2_line2] & chr(10) & chr(13)
>shippingAddress.[city] & ", " & _
>[region_code] & " " & shippingAddress[postal_code] & _
>(10) & chr(13)
| |
| Ravi Shankar 2004-05-06, 1:36 am |
| There is an instance of "PipelineInfo" class created
before you can execute it using the "RunPipe" method.
In "Retail2002" code you should find all this
in "TxContext.vb" under "Transactions" project.
There in the PipelineInfo instantiation you could add the
following code
1. DataFunctions oDF = new DataFunctions(....)
2. PipelineInfo.Items("DataFunctions") = oDF
then inside your Pipeline Component you'd be able to
retrieve it from the context object using the
key "DataFunctions"
HTH
>-----Original Message-----
>Right.
>
>And as Retail2002 uses Global.asax files...Should I
declare a
>DataFunctions object before calling the pipeline, or add
it to the
>overall class? (as per MSDN):
>
>Public Class Retail2002
>
> Inherits CommerceApplication
>
>End Class
>
>Additionally, you say the context is built up prior to
the call. Will
>the context grab from the application (do the above,
forget about
>everything else), or do I need to modify it (pipeline,
context)
>somehow?
>
>Thanks,
>Ryan
>
>
>
>
>
>
>
>On Tue, 4 May 2004 21:58:10 -0700, "Ravi Shankar"
><shankar.nospam@hp.com> wrote:
>
context[vbcol=seagreen]
component[vbcol=seagreen]
flags)[vbcol=seagreen]
>
>.
>
| |
| Sandra Castellanos 2004-05-06, 10:51 am |
| on what namespace can I find DataFunctions?
"Ravi Shankar" <shankar.nospam@hp.com> wrote in message
news:91c101c43328$c9b46e10$a301280a@phx.gbl...[vbcol=seagreen]
> There is an instance of "PipelineInfo" class created
> before you can execute it using the "RunPipe" method.
> In "Retail2002" code you should find all this
> in "TxContext.vb" under "Transactions" project.
>
> There in the PipelineInfo instantiation you could add the
> following code
>
> 1. DataFunctions oDF = new DataFunctions(....)
> 2. PipelineInfo.Items("DataFunctions") = oDF
>
> then inside your Pipeline Component you'd be able to
> retrieve it from the context object using the
> key "DataFunctions"
>
> HTH
> declare a
> it to the
> the call. Will
> forget about
> context)
> context
> component
> flags)
| |
| Sandra Castellanos 2004-05-06, 10:51 am |
| Sorry, I found it.
Now, I have a little problem. I am trying to send a confirmation email too,
but in the example, they send order_id as the tracking number which is in
currentOrderForm, but my tracking number is order_number in
parentOrderGroup. Do you know how I can, from the script, access that field?
| |
| Ravi Shankar 2004-05-06, 12:04 pm |
| I assume you've had a look at the "MakePO" component in
the documentation. It shows how you can create a template
file and in the template file you'd specify your tracking
number as
Tracking # <%%= CStr(order_number) %%>
HTH
>-----Original Message-----
>Sorry, I found it.
>
>Now, I have a little problem. I am trying to send a
confirmation email too,
>but in the example, they send order_id as the tracking
number which is in
>currentOrderForm, but my tracking number is order_number
in
>parentOrderGroup. Do you know how I can, from the
script, access that field?
>
>
>.
>
| |
| Sandra Castellanos 2004-05-06, 12:04 pm |
| Exactly, the thing is that order_number is not in the currentOrderForm but
in the parentOrderGroup. This is the part I don't know how to address.
"Ravi Shankar" <shankar.nospam@hp.com> wrote in message
news:95f801c43380$d57631e0$a301280a@phx.gbl...[vbcol=seagreen]
> I assume you've had a look at the "MakePO" component in
> the documentation. It shows how you can create a template
> file and in the template file you'd specify your tracking
> number as
>
> Tracking # <%%= CStr(order_number) %%>
>
> HTH
>
> confirmation email too,
> number which is in
> in
> script, access that field?
| |
| ryanr@nni.com 2004-05-06, 12:39 pm |
| Alright, I am adding a DataFunctions object in the following manner
(and I know I'm probably testing your patience):
>
>
> pipeInfo = NewPipelineInfo(BasketPipeName)
>
>
>
> If CartOrderForm.LineItems.Count > 0 Then
> Cart.RunPipeline(pipeInfo)
>
> pipeInfo = NewPipelineInfo(TotalPipeName)
> Cart.RunPipeline(pipeInfo)
>
> pipeInfo = NewPipelineInfo(CheckoutPipeName)
> Dim oDF As DataFunctions = New DataFunctions
> pipeInfo.Item("DataFunctions") = oDF
> Cart.RunPipeline(pipeInfo)
> End If
Since the Email component is part of the Checkout Pipeline.
The Scriptor (right before SendSMTP) contains the following:
>'The following entry points are available (shown in VBScript format):
>
>function MSCSExecute(config, orderform, context, flags)
>Dim DataFunctions
>Set DataFunctions = context.DataFunctions
>
>orderform.[_email_subject] = "Order Confirmation #: " & _
> orderform.[order_id]
>
>
>msgBody = "Thank you for your order." & chr(10) & chr(13) & _
> "Order id: " & orderform.[order_id] & chr(10) & chr(13) & _
> "Order Date: " & DataFunctions.Date(orderform.[date_changed]) & _
> chr(10) & chr(13) & _
> "Order Total: " & _
> DataFunctions.Money(CLng(orderform.[_cy_total_total])) & _
> chr(10) & chr(13) & chr(10) & chr(13)
>
>
>
> MSCSExecute = 1
>end function
However, I receive the following error:
>Pipeline Error: Component Execution failed for component[0x3] hr: 0x80020101
>ProgID: Commerce.Scriptor.1
>MscsExecute() failed.
>Script invocation failed.
>Type mismatch: 'DataFunctions.Date'
>Line: 11.
Which leads me to believe that the most probable cause (aside from
declaring something wrong) is that locale information is not set. Any
ideas how to set it to US, dollar, English?>
Many Thanks,
Ryan
On Wed, 5 May 2004 22:12:54 -0700, "Ravi Shankar"
<shankar.nospam@hp.com> wrote:
[vbcol=seagreen]
>There is an instance of "PipelineInfo" class created
>before you can execute it using the "RunPipe" method.
>In "Retail2002" code you should find all this
>in "TxContext.vb" under "Transactions" project.
>
>There in the PipelineInfo instantiation you could add the
>following code
>
> 1. DataFunctions oDF = new DataFunctions(....)
> 2. PipelineInfo.Items("DataFunctions") = oDF
>
>then inside your Pipeline Component you'd be able to
>retrieve it from the context object using the
>key "DataFunctions"
>
>HTH
>declare a
>it to the
>the call. Will
>forget about
>context)
>context
>component
>flags)
| |
| Ravi Shankar 2004-05-11, 8:20 pm |
| Sorry, I made a mistake...
As per the documentation the MakePO components exposes
the OrderGroup object through "Items" dictionary so your
order number should be accessible as
Tracking # <%%= CStr(Items.Value(order_number)) %%>
What this means is that the "LineItems" collections would
thus be "Items.Items.Value()....."
HTH.
>-----Original Message-----
>Exactly, the thing is that order_number is not in the
currentOrderForm but
>in the parentOrderGroup. This is the part I don't know
how to address.
>"Ravi Shankar" <shankar.nospam@hp.com> wrote in message
>news:95f801c43380$d57631e0$a301280a@phx.gbl...
template[vbcol=seagreen]
tracking[vbcol=seagreen]
order_number[vbcol=seagreen]
>
>
>.
>
| |
| Ravi Shankar 2004-05-11, 8:20 pm |
| Yes. The DataFunctions.Locale is not set.
For English (United States) this value is 0x0409.
So you'd add "oDF.Locale = &H0409" after the instantiation
HTH
>-----Original Message-----
>Alright, I am adding a DataFunctions object in the
following manner
>(and I know I'm probably testing your patience):
>
>
>Since the Email component is part of the Checkout
Pipeline.
>
>The Scriptor (right before SendSMTP) contains the
following:
>
VBScript format):[vbcol=seagreen]
_[vbcol=seagreen]
(13) & _[vbcol=seagreen]
(10) & chr(13) & _[vbcol=seagreen]
(orderform.[date_changed]) & _[vbcol=seagreen]
[_cy_total_total])) & _[vbcol=seagreen]
>
>However, I receive the following error:
>
[0x3] hr: 0x80020101[vbcol=seagreen]
>
>Which leads me to believe that the most probable cause
(aside from
>declaring something wrong) is that locale information is
not set. Any
>ideas how to set it to US, dollar, English?>
>
>Many Thanks,
>Ryan
>
>
>
>
>
>
>
>On Wed, 5 May 2004 22:12:54 -0700, "Ravi Shankar"
><shankar.nospam@hp.com> wrote:
>
the[vbcol=seagreen]
add[vbcol=seagreen]
Confirmation[vbcol=seagreen]
>
>.
>
| |
| Sandra Castellanos 2004-05-11, 8:20 pm |
| No, that's the thing. the MakePO exposes the OrderForm trough the Items
Dictionary. But the field "order_number" is stored in the ParentOrderGroup
"Ravi Shankar" <shankar.nospam@hp.com> wrote in message
news:9a3001c43437$578535d0$a401280a@phx.gbl...[vbcol=seagreen]
> Sorry, I made a mistake...
>
> As per the documentation the MakePO components exposes
> the OrderGroup object through "Items" dictionary so your
> order number should be accessible as
>
> Tracking # <%%= CStr(Items.Value(order_number)) %%>
>
> What this means is that the "LineItems" collections would
> thus be "Items.Items.Value()....."
>
> HTH.
>
> currentOrderForm but
> how to address.
> template
> tracking
> order_number
| |
| ryanr@nni.com 2004-05-11, 8:20 pm |
| Hmm. Same message (Type Mismatch for DataFunctions.Date).
Why would this script (just to check if it will set) fail?
Function mscsexecute(config, orderform, context, flags)
Dim DataFunctions
Dim msgBody
Set DataFunctions = context.[DataFunctions]
mscsexecute = 1
End Function
This makes no sense.
Many Thanks,
Ryan
On Fri, 7 May 2004 06:38:47 -0700, "Ravi Shankar"
<shankar.nospam@hp.com> wrote:
[vbcol=seagreen]
>Yes. The DataFunctions.Locale is not set.
>
>For English (United States) this value is 0x0409.
>
>So you'd add "oDF.Locale = &H0409" after the instantiation
>
>HTH
>
>following manner
>Pipeline.
>following:
>VBScript format):
>_
>(13) & _
>(10) & chr(13) & _
>(orderform.[date_changed]) & _
>[_cy_total_total])) & _
>[0x3] hr: 0x80020101
>(aside from
>not set. Any
>the
>add
>Confirmation
| |
| ryanr@nni.com 2004-05-11, 8:20 pm |
| Hmm. Nothing seems to work.
'The following entry points are available (shown in VBScript format):
function MSCSExecute(config, orderform, context, flags)
Dim DataFunctions
Set DataFunctions = context.[DataFunctions]
orderform.[_email_subject] = "Order Confirmation #: " & _
orderform.[order_id]
msgBody = "Thank you for your order." & chr(10) & chr(13) & _
"Order id: " & orderform.[order_id] & chr(10) &
chr(13) & _
"Order Date: " &
DataFunctions.Date(orderform.[date_changed]) & _
chr(10) & chr(13) & _
"Order Total: " & _
DataFunctions.Money(CLng(orderform.[_cy_total_total]))
& _
chr(10) & chr(13) & chr(10) & chr(13)
MSCSExecute = 1
end function
No matter how I redefine context (context.DataFunctions,
context.[DataFunctions], context.["DataFunctions"]) is does not seem
to work. Unless, type mismatch isn't a problem with (Set) but with the
function Date().
Will check,
Ryan
On Fri, 7 May 2004 06:38:47 -0700, "Ravi Shankar"
<shankar.nospam@hp.com> wrote:
[vbcol=seagreen]
>Yes. The DataFunctions.Locale is not set.
>
>For English (United States) this value is 0x0409.
>
>So you'd add "oDF.Locale = &H0409" after the instantiation
>
>HTH
>
>following manner
>Pipeline.
>following:
>VBScript format):
>_
>(13) & _
>(10) & chr(13) & _
>(orderform.[date_changed]) & _
>[_cy_total_total])) & _
>[0x3] hr: 0x80020101
>(aside from
>not set. Any
>the
>add
>Confirmation
| |
| Ravi Shankar 2004-05-11, 8:20 pm |
| Hmmm... have you stopped the Worker Process & the web
site (if you working in IIS 6) or shutdown & restarted
your application in IIS 5 mode... because here is what I
did on an uncustomized Retail2002 Site and it worked...
1. In the txContext.vb I amended the "NewPipelineInfo"
call (line 442) to look like this
As String) As PipelineInfo[vbcol=seagreen]
Thread.CurrentThread.CurrentUICulture.Name[vbcol=seagreen]
I had to include "MSCSAspHelpLib" to get
the "DataFunctions" object and "Import
Microsoft.CommerceServer.Interop" at the beginning of
txContext.VB
2. In the "basket.pcf" I added a "scriptor" object to
the "Inventory" stage where I added the following code
[vbcol=seagreen]
VBScript format):[vbcol=seagreen]
(now)[vbcol=seagreen]
3. Then I went into "Cart.aspx" and in the asp repeater
control and in one of the empty TD elements for every
item I added the following code
[vbcol=seagreen]
(Container.DataItem, "[_my_sillydate]") %>
PS: forgive my variable naming 
4. I rebuilt the Transaction Project
5. Then I went into IIS Manager (I'm on W2K3) and
shutdown my default site, went into Application Pools and
shutdown the "Default Pool". waited for 30 secs 
restarted the "Default Pool", then restarted the "Default
Web Site"
6. Went into IE... opened the site, logged in as a
registered user, added an item to my cart and went to
view the cart..
There on the TD element I get "5/8/2004" just like
it should.. means that the data functions call
succeeded...
HTH
[vbcol=seagreen]
>-----Original Message-----
>Hmm. Nothing seems to work.
>
>'The following entry points are available (shown in
VBScript format):
>
>function MSCSExecute(config, orderform, context, flags)
>Dim DataFunctions
>Set DataFunctions = context.[DataFunctions]
>
>orderform.[_email_subject] = "Order Confirmation #: " & _
> orderform.[order_id]
>
>
>msgBody = "Thank you for your order." & chr(10) & chr
(13) & _
> "Order id: " & orderform.[order_id] & chr
(10) &
>chr(13) & _
> "Order Date: " &
>DataFunctions.Date(orderform.[date_changed]) & _
> chr(10) & chr(13) & _
> "Order Total: " & _
> DataFunctions.Money(CLng(orderform.
[_cy_total_total]))
>& _
> chr(10) & chr(13) & chr(10) & chr(13)
>
>
>
> MSCSExecute = 1
>end function
>
>
>No matter how I redefine context (context.DataFunctions,
>context.[DataFunctions], context.["DataFunctions"]) is
does not seem
>to work. Unless, type mismatch isn't a problem with
(Set) but with the
>function Date().
>
>Will check,
>Ryan
>
>
>
>On Fri, 7 May 2004 06:38:47 -0700, "Ravi Shankar"
><shankar.nospam@hp.com> wrote:
>
instantiation[vbcol=seagreen]
(CheckoutPipeName)[vbcol=seagreen]
DataFunctions[vbcol=seagreen]
flags)[vbcol=seagreen]
&[vbcol=seagreen]
component[vbcol=seagreen]
is[vbcol=seagreen]
to[vbcol=seagreen]
(pipeline,[vbcol=seagreen]
chr(10) &[vbcol=seagreen]
[order_id] & chr[vbcol=seagreen]
dataFunctions.Date[vbcol=seagreen]
(orderform.[vbcol=seagreen]
(13)[vbcol=seagreen]
Addresses"[vbcol=seagreen]
shipment.[vbcol=seagreen]
orderform.[vbcol=seagreen]
by: " &[vbcol=seagreen]
&[vbcol=seagreen]
& _[vbcol=seagreen]
shippingAddress.[vbcol=seagreen]
(shippingAddress.[vbcol=seagreen]
msgBody[vbcol=seagreen]
(13)[vbcol=seagreen]
&[vbcol=seagreen]
& _[vbcol=seagreen]
& chr[vbcol=seagreen]
>
>.
>
| |
| ryanr@nni.com 2004-05-11, 8:20 pm |
| Many thanks. Found the problem: DataFunctions works correctly, but no
date is being supplied, causing an exception.
The code printed in "Building Solutions With Microsoft Commerce Server
2002" needs to be updated for Retail2002.
I'm off the find the analog to (shipments) in the orderform
dictionary.
-Ryan
On Fri, 7 May 2004 23:09:40 -0700, "Ravi Shankar"
<shankar.nospam@hp.com> wrote:
[vbcol=seagreen]
>Hmmm... have you stopped the Worker Process & the web
>site (if you working in IIS 6) or shutdown & restarted
>your application in IIS 5 mode... because here is what I
>did on an uncustomized Retail2002 Site and it worked...
>
> 1. In the txContext.vb I amended the "NewPipelineInfo"
>call (line 442) to look like this
>
>As String) As PipelineInfo
>Thread.CurrentThread.CurrentUICulture.Name
>
>I had to include "MSCSAspHelpLib" to get
>the "DataFunctions" object and "Import
>Microsoft.CommerceServer.Interop" at the beginning of
>txContext.VB
>
> 2. In the "basket.pcf" I added a "scriptor" object to
>the "Inventory" stage where I added the following code
>
>VBScript format):
>(now)
>
> 3. Then I went into "Cart.aspx" and in the asp repeater
>control and in one of the empty TD elements for every
>item I added the following code
>
>(Container.DataItem, "[_my_sillydate]") %>
>
>PS: forgive my variable naming 
>
> 4. I rebuilt the Transaction Project
>
> 5. Then I went into IIS Manager (I'm on W2K3) and
>shutdown my default site, went into Application Pools and
>shutdown the "Default Pool". waited for 30 secs 
>restarted the "Default Pool", then restarted the "Default
>Web Site"
>
> 6. Went into IE... opened the site, logged in as a
>registered user, added an item to my cart and went to
>view the cart..
>
> There on the TD element I get "5/8/2004" just like
>it should.. means that the data functions call
>succeeded...
>
>HTH
>
>
>VBScript format):
>(13) & _
>(10) &
>[_cy_total_total]))
>does not seem
>(Set) but with the
>instantiation
>(CheckoutPipeName)
>DataFunctions
>flags)
>&
>component
>is
>to
>(pipeline,
>chr(10) &
>[order_id] & chr
>dataFunctions.Date
>(orderform.
>(13)
>Addresses"
>shipment.
>orderform.
>by: " &
>&
>& _
> shippingAddress.
>(shippingAddress.
>msgBody
>(13)
>&
>& _
>& chr
| |
| Sandra Castellanos 2004-05-11, 8:20 pm |
| no ideas on this? 
"Sandra Castellanos" <sandrac@washuway.com> wrote in message
news:O3R618ENEHA.1644@TK2MSFTNGP09.phx.gbl...
> No, that's the thing. the MakePO exposes the OrderForm trough the Items
> Dictionary. But the field "order_number" is stored in the ParentOrderGroup
>
>
> "Ravi Shankar" <shankar.nospam@hp.com> wrote in message
> news:9a3001c43437$578535d0$a401280a@phx.gbl...
>
>
|
|
|
|
|