Switch expression error - end of expression expected

Hello all! Hopefully you can help me out :confounded:

I am trying to pass the following expression into “switch” and keep getting an “end of expression expected” error.

Bcc1 and Bcc2 are variables set to “True” or “False” (not boolean, but a string from an excel file), and rows (1) and (2) are from a datatable (I’m trying to run the switch in a “for each row” activity).

Here is the looong expression:

If (Bcc1=“True"And Bcc2=“True” And row(1).tostring<>”" And row(2).tostring<>“”,“Default”, If(Bcc1=“True” And Bcc2=“True” And row(1).tostring<>“” And row(2).tostring=“”,“1”, If(Bcc1=“True” And Bcc2=“True” And row(1),tostring=“” And row(2).tostring<>“”,“2”,If(Bcc1=“True” And Bcc2=“True” And row(1).tostring=“” And row(2).tostring=“”,“3”,If(Bcc1=“True” And Bcc2=“False” And row(1).tostring<>“” And row(2).tostring<>“”,“4”,If(Bcc1=“True” And Bcc2=“False” And row(1).tostring<>“” And row(2).tostring=“”,“5”,If(Bcc1=“True” And Bcc2=“False” And row(1).tostring=“” And row(2).tostring<>“”,“6”,If(Bcc1=“True” And Bcc2=“False” And row(1).tostring=“” And row(2).tostring=“”,“7”,If(Bcc1=“False” And Bcc2=“True” And row(1).tostring<>“” And row(2).tostring<>“”,““8,If(Bcc1=“False” And Bcc2=“True” And row(1).tostring<>”” And row(2).tostring=“”,“9”,If(Bcc1=“False” And Bcc2=“True” And row(1).tostring=“” And row(2).tostring<>“”,“10”,If(Bcc1=“False” And Bcc2=“True” And row(1).tostring=“” And row(2).tostring=“”,“11”,If(Bcc1=“False” And Bcc2=“False” And row(1).tostring<>“” And row(2).tostring<>“”,“12”,If(Bcc1=“False” And Bcc2=“False” And row(1).tostring<>“” And row(2).tostring=“”,“13”,If(Bcc1=“False” And Bcc2=“False” And row(1).tostring=“” And row(2).tostring<>“”,“14”,“15”)))))))))))))))

I have 16 possible outcomes and really want to get it all done in switch.
If you could take a look at my expression and perhaps tell me where I’m going wrong, I’d rreeaaally appreciate it :pleading_face:

Thanks in advance!

apologies, there was a comma in the code so I will paste the repaired code below. I am now getting a new error after fixing it. "Comma, ‘)’, or a valid expression continuation expected.

Did I count my parenthesis wrong?

Except for the comma that you already found, the 8 is outside the quotation marks.

Hi,

I recommend to use as the following expression.

-8*CInt(Bcc1="True")-4* CInt( Bcc2="True") -2* Cint(row(1).ToString="")-Cint(row(2).ToString="")

This returns a value between 0 and 15 depending on 4 conditions.

Regards,

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