Getting error while using expression

Getting below error while using the exepression.

image

have a check that VisualBasic is imported
grafik

give a try to use in_TransactionItem.Specifi…).toString

Yeah you can’t use dictionaries like that. The system has no way of knowing what’s in that Key. It could be any type of value, even complex values like arrays and datatables, since a QueueItem variable is dictionary of string, object.

Another way to achieve this would be to put this into a Try/Catch…

Assign tempVar = CInt(in_TransactionItem.SpecificContent(“CashIn”).ToString)

If that errors, then the value isn’t numeric, and you can handle this in the Catch.

Hi @vaibhav2.chavan,

The issue here is that your are trying to get SpecificContent, which has to be first extracted by using ToString method.

in_TransactionItem.SpecificContent(“CashIn”).ToString

IsNumeric is redundant as all values obtained from in_TransactionItem.SpecificContent need to be with .ToString

For output, yes. But for actual usage, no. Since SpecificContent is string, object - you could have a datatable, integer, string, array, pretty much anything as the Value.

We can store objects but those are casted to string in orchestrator so when getting any value from in_transactionitem and specific content we have to start at ToString and then cast it in UiPath back to the form (type) sent by the dispatcher.

For example:
If it’s originally a datatable then using deserialize (variable from specific content.ToSting)

They are not casted to string in Orchestrator. That doesn’t even make sense. Orchestrator doesn’t process your code.

You can have any datatype as the Value. Depending on the datatype, something like .ToString will fail. For example, if transactionItem.SpecificContent(“MyValue”) is datatype datatable, then transactionItem.SpecificContent(“MyValue”).ToString will fail.

The .ToString is just for when you want to output (log message, type into, etc) the value. It doesn’t affect how the value is stored, what its datatype is, nor how you’d use it in other places.

“If it’s originally a datatable then using deserialize (variable from specific content.ToSting)”

You don’t have to do that. You can just directly reference SpecificContent(“MyDT”) as you would any other datatable.

@jeevith @postwick @ppr - I saw in one of the video the person has used the expression - IsNumeric(in_TransactionItem.SpecificContent(“CashIn”))

Without any error. So please let me know what’s wrong I’m doing.

That’s a half hour video. Let us know where in the video you’re seeing it.

Anyway, have you tried our suggestions?

@postwick - Please watch it from 19.38.

Whatever is seen in the orchestrator queue item GUI came from the dispatcher. The text you see in orchestrator off course is not casted. No one said it is converted there. You did not interpret my sentence correctly.

It is all converted to json string from the dispatcher itself so that orchestrator can be the middle man with a user interface.

But I can agree on the second part of your suggestion that specific contents can be datatable and ToString method to those specificcontent keys are not needed. Although, I will have to check it myself once.

Wait, do you actually have a variable named in_TransactionItem? Did you populate it by getting an item from the Queue?

Ok I see what you meant. I was just talking about dictionaries in general, you were talking of things that were gotten from a Queue (where complex datatypes are not possible). We’re both correct :slight_smile:

@postwick it’s the REFramework internal argument :slight_smile:
It has in_TransactionItem as one of the variable a state and argument further in Process.xaml

doesn tell us anything about the imported namespaces. Was this checked by you as mentioned above?