Assign: Syntax error: Missing operand after 'O' operator

I have used an assign activity…to assign a value to variable.
And I’m getting this error occasionally.

what is this error and why it is occurring ?

Please help me.

Hi @Praw1n

Can we know what type of variable you re creating and what type of value are you passing in assign with screenshot so that we may able be sort it out Quickly?

Regards

I’m using… Dt_Row as a variable of type DataRow.

Dt_Row = Dt1.Select(“[Column1]= '”+VariableName+“'”)

where, VariableName is a row item of Dt2(Column1)

Dt_Row = Dt1.Select("[Column1]= '"+VariableName+"'")

VariableName is string variable ?
Dt_Row is Datarow[]?
Regards,
Arivu

Yes, It is a string. @arivu96

Dt_Row = Dt1.Select("[Column1]= '"+VariableName+"'")
if you are using above query then its correct can you send the error screenshot

Regards,
Arivu

Please send the syntax screenshot

Variable Name
image

Syntax
image

Data Types…


The syntax is correct can you pls check the Pur_item having any special char in the string.
please print the value and check

Regards,
Arivu

While executing the program…
I’m getting this error when the

Pur_Item = FFKM ‘O’ RING FOR 70MM DOUBLE MECHANICAL SEAL

Need to remove the special char before you apply filter because in dt.select filter we are using ’ char to specify the string value

Try below query

From p in GRN_Dt.Select() where p("Item").Equals(Pur_Item) Select p).ToArray.CopyToDataTable()

Regards,
Arivu

1 Like

Do you mean ‘O’ is a special character ?

But we are assigning values to Pur_Item Dynamically. How can we rectify this ???

Hi,

Can you try the following expression? This escapes single quote.

GRN_DT.Select("[Item]='"+Pur_Item.Replace("'", "''")+"'")

Regards,

1 Like

Pls remove the ( before p.

(from p in GRN_Dt.Select() where p("Item").Equals(Pur_Item) select p).ToArray().CopyToDataTable()

are you using c# or vb.net
Regards,
Arivu