Scriptor

I have added a scriptor component to the Total Pipeline. This code is an offshot out of the book Developing with MS CS 2002. What I basically need to get is the Ship To State so I can determine a tax value etc.

CS 2007 seems to have a problem on the line:

Shipments = orderform.[shipments]

The Event Views states: "Wrong Numbr of Arguments or invalid Property Assignment"

'The following entry points are available (shown in VBScript format):

function MSCSExecute(config, orderform, context, flags)

Dim State
Dim Shipments
Dim TaxTotal

Shipments = orderform.[shipments]

For each Shipment in Shipments
shippingAddressId = shipment.[shipping_address_id]
shippingAddress = orderform.[Addresses].Value(shippingAddressId)
State = shippingAddress.[region_code]

next

TaxTotal = 0

'Put Logic Here

orderform.[_cy_tax_total] = TaxTotal

MSCSExecute = 1
end function

sub MSCSOpen(config)

end sub


sub MSCSClose()

end sub

[1071 byte] By [Xcel] at [2008-2-13]
# 1

Xcel,

Shipments might be a dictionary object, so I don't think you can use a straight assignment statement like that.

JosephJohnson at 2007-9-4 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 2

Can you drop the DumpOrder scriptor component in front of your scriptor to verify that the shipments exists in the collection? Did you put a splitter component prior to your scriptor to create the shipments collection? The error message seems to indicate that the shipments element does not exist. Shipements should be an ISimpleList (however the entities inside of it are IDictionary elements).

You can also enable debugging on the Scriptor component and break into it using just-in-time debugging.

Cheers,
Colin

ColinBowern at 2007-9-4 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 3

Even though this is an old post, I was wondering if you ever got it to work. I assume your problem was related to not setting the shipments dictionary properly with a set statement. But after that was resolved were you able to write the tax amount into the orderform from the scriptor without issues?

I ask because I'm having a difficult time writing values back to the orderform object without generating a marshalling error (CS2007). The interesting part is this only seems to affect numeric (specifically currency) values. Creating and writing to new weakly typed entries in the orderform works fine. But updating things like order.[_cy_tax_total] and order.[_cy_shipping_total] are failing regardless of what type I am passing in (string, decimal, integer, etc.).

Just curious what your results were since you posted a few messages about scriptor problems in the past.

PhillipU at 2007-9-4 > top of Msdn Tech,Commerce Server,Commerce Server 2007...