BC20198 ')' expected at Line 1

Hi,

I am getting this error in the **invoke code. ** I have checked many times however I could not really find what is causing this error (BC30198 ‘)’ expected at Line 1

image

in_dt_dsrDtRaw.AsEnumerable().ToList().ForEach(Sub (row) If(row(“INVOICE_NUMBER”).tostring.substring(0,3)=“950”,row(“BILLED_QTY”)=0 And row(“LOCAL_CURR_AMOUNT”) = row(“LOCAL_CURR_AMOUNT”) * -1 And row(“NET_AMOUNT”)=row(“NET_AMOUNT”) * -1,row(“BILLED_QTY”) And row(“LOCAL_CURR_AMOUNT”) And row(“NET_AMOUNT”)))

I need to check for a condition if the INVOICE_NUMBER has certain numbers after getting the first 3 characters converting it from number to string, then update the other columns with certain values else retain the same values.

Thank you in advance for all the great help.

Regards,
Manjesh

Hi @manjesh_kumar ,

Could you toggle it over to CSharp and given this a try?

in_dt_dsrDtRaw.AsEnumerable().
Where(w => w["INVOICE_NUMBER"].ToString().Substring(0,3)=="950").ToList().
ForEach(row =>{
	row["BILLED_QTY"]=0;
	row["LOCAL_CURR_AMOUNT"] = Convert.ToDecimal(row["LOCAL_CURR_AMOUNT"].ToString()) * -1;
	row["NET_AMOUNT"]=Convert.ToDecimal(row["NET_AMOUNT"].ToString()) * -1;});

Kind Regards,
Ashwin A.K

1 Like

Hi,

FYI, VB expression for it will be the following.

in_dt_dsrDtRaw.AsEnumerable().ToList().ForEach(Sub (row) 
    If(row("INVOICE_NUMBER").tostring.substring(0,3)="950") Then
        row("BILLED_QTY")=0
        row("LOCAL_CURR_AMOUNT") = Double.Parse(row("LOCAL_CURR_AMOUNT").ToString) * -1
        row("NET_AMOUNT")=Double.Parse(row("NET_AMOUNT").ToString) * -1
    End If
End Sub
 )
2 Likes

Dear @ashwin.ashok @Yoichi ,

Both of them worked, than you for that. I would be using the VB code since I mostly use it.

I would like to know was there any issue in the code that I had written. Appreciate your feedback for the same.

Regards,
Manjesh

Hi,

If operator can have just value (not multiple expressions), as argument. In addition, in Vb, = means comparison operator and assignment operator, and it will work as comparison operator in your expression (against your intention).
So we need to use If statement with multi lines, in this case.

Or Where method (which @ashwin.ashok shows) also good approach.

Hope this helps you.

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.