Developer forum

Forum » Integration » Integration Error on Code Expression

Integration Error on Code Expression

Kyle Fesmire
Reply

Encountered a situation on a data integration project for one of our DynamicWeb clients.  Trying to use a Code expression in a data mapping.  The team is following the documentation here under "Scripting" that shows how to use data values from the source row in your code expression via data["field_name"]

https://doc.dynamicweb.dev/manual/dynamicweb10/integration/setup/activities.html?tabs=general#scripting

When they try to run the integration, they’re get an error compiling the code expression that seems to indicate that `data` is not something that exists in the current context (see exception message and stack trace below).

Also, they are doing a bit of decompiling and looking at the CodeExpressionEvaluator class, it indeed looks like it does NOT actually pass a 'data' parameter into the expression being executed.  Is there missing something here, or is there really no way to access the row data from within a code expression?

Error: Error occurred when compiling code expression: Decimal.Parse(data["List_Price"], System.Globalization.NumberStyles.AllowCurrencySymbol  System.Globalization.NumberStyles.AllowDecimalPoint  System.Globalization.NumberStyles.AllowThousands, new System.Globalization.CultureInfo("en-US")) CS0103: The name 'data' does not exist in the current context  Stack:    at Dynamicweb.Extensibility.ExpressionEvaluators.CodeExpressionEvaluator.CompileExpression(String expression)    at Dynamicweb.Extensibility.ExpressionEvaluators.CodeExpressionEvaluator.Evaluate(String expression)    at Dynamicweb.Extensibility.ExpressionEvaluators.ExpressionEvaluator.ExpandValue(String value)    at Dynamicweb.DataIntegration.Integration.ScriptTypes.CodeScriptType.GetValueTyped(Object input)    at Dynamicweb.DataIntegration.Integration.ScriptTypeProvider`1.GetValue(Object input)    at Dynamicweb.DataIntegration.Integration.ColumnMapping.GetScriptValue()    at Dynamicweb.DataIntegration.Providers.EcomProvider.EcomDestinationWriter.Write(Dictionary`2 row, Mapping mapping, Boolean discardDuplicates)    at Dynamicweb.DataIntegration.Providers.EcomProvider.EcomProvider.RunJob(Job job)

Let me know if you need any more info. 

Thanks!

KF


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

What version are you on? I think this was added very recently so you may not have it available?

Imar

 
Kyle Fesmire
Reply

They are using DW version 10.18.9, Swift version 1.26.8

 

Thanks!
KF

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Kyle,
that feature will be available in the next DW 10.20.7 and DW 10.21.
BR, Dmitrij

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I can confirm this is now working in 10.20.7. I love it; this is a game changer for simplifying and empowering integrations!

 

 

You must be logged in to post in the forum