Multiple Assign:Can Not Assign

Hii,
I have design job for extract data from pdf And Post Data to Server using Rest Api Post Method .So I’m using Multi assign Activity in job ,Try To assign Value But getting Error
(Multiple Assign: Can not assign ‘dtOutput.Select(“[Column1]=‘branchCode’”).ElementAt(0)(“row1”).ToString’ to ‘jobj(“branchCode”)’.) Please Check Attach Screen Shot ,
Kindly Help me To Resolve Issue

Hi @ashwini.mali,

Can you set a breakpoint to the multiple assign and debug the process? The reason for the error is not clear at the moment. Maybe we can find an answer by typing the assign statement to watch that you get an error.

Kind Regards

I’m New for Uipath studio
Please tell me how can set breakpoint ?

please Check below error
22.4.4+Branch.support-v22.4.Sha.1090422ff8ac244a830d9e33650f90eb9cddd56a

Source: Multiple Assign (Throw)

Message: Can not assign ‘dtOutput.Select(“[branchCode]=‘branchCode’”).ElementAt(0)(“row1”).ToString’ to ‘jobj(“branchCode”)’.

Exception Type: System.InvalidOperationException

RemoteException wrapping System.InvalidOperationException: Can not assign ‘dtOutput.Select(“[branchCode]=‘branchCode’”).ElementAt(0)(“row1”).ToString’ to ‘jobj(“branchCode”)’. —> RemoteException wrapping System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.SZArrayHelper.get_Item[T](Int32 index)
at System.Linq.Enumerable.ElementAt[TSource](IEnumerable1 source, Int32 index) at lambda_method(Closure , ActivityContext ) at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context)
at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context) at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity)
at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor) at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath) at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate)
at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
— End of inner exception stack trace —
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Hi,

I guess your specified query does not return anything.

In UiPath’s select query, you need to set a variable for ‘branchCode’ as strBranchCode.

You can try dtOutput.Select(“[branchCode]=strBranchCode”).ElementAt(0)(“row1”).ToString

Hello @ashwini.mali

Please confirm the variable type of “jobj”. Also if possible share the full screenshot of the workflow for better understanding.

Thanks

variable type of jobj is jsonObject

branchCode is the column name of built data table

@ashwini.mali

just try as below.

dtOutput.AsEnumerable.Select(Function(y) y(“ColumnName”).ToString.Trim).ToArray().Contains(“branchCode”)

Thanks

Hi @ashwini.mali

  1. Add a togle break point in multiple assign and run in debug mode. Type
    dtOutput.Select(“[Column1]=‘branchCode’”).ElementAt(0)(“row1”).ToString in immediate pannel and send the screenshot.

What value you are getting?

Make sure jobj variable should be initialized with new JObject

How to add break point ,and which activity used?

@ashwini.mali

OR use short cut key f9

In debug mode

click on immediate panel and type the jobj(“branchCode”) and hit enter.

Kindly Check Attached File (Main Job design
Main.xaml (57.3 KB)
)

@ashwini.mali what are dependencies you are using here

image

Errors in that activity so that Commented thos achtivity

i Design this job for extract the data from pdf file and Pass the data to server using Rest API (Parameterized post Method ) And i want pass parameter dynamic (At run time).Till Excel Activity job work properly But After that getting error .
Please guide me to resolve error

@ashwini.mali

initialize mainJsonObj variable to new jobject

ok but remaining all things are right or not ?