How do I break a single statement into multiple lines?
Forums
I'm trying to break down the following equation so it can all be seen in the IDEA scripting window:
field.Equation = "@If(@Left(ACCOUNT1,1)=""1"" .OR. @Left(ACCOUNT1,1)=""2"".OR. @Left(ACCOUNT1,1)=""3"".OR. @Left(ACCOUNT1,1)=""4"".OR. @Left(ACCOUNT1,1)=""5"".OR. @Left(ACCOUNT1,1)=""6"".OR. @Left(ACCOUNT1,1)=""7"",@Left(ACCOUNT1, 5), @If(@Left(ACCOUNT2,1)=""1"" .OR. @Left(ACCOUNT2,1)=""2"".OR. @Left(ACCOUNT2,1)=""3"".OR. @Left(ACCOUNT2,1)=""4"".OR. @Left(ACCOUNT2,1)=""5"".OR. @Left(ACCOUNT2,1)=""6"" .OR. @Left(ACCOUNT2,1)=""7"", @Left(ACCOUNT2,5), @If(@Left(ACCOUNT3,1)=""1"" .OR. @Left(ACCOUNT3,1)=""2"".OR. @Left(ACCOUNT3,1)=""3"".OR. @Left(ACCOUNT3,1)=""4"".OR. @Left(ACCOUNT3,1)=""5"".OR. @Left(ACCOUNT3,1)=""6"".OR. @Left(ACCOUNT3,1)=""7"", @Left(ACCOUNT3,5), ""No Account Listed"")))"
I know you have to typically add a "& _" to the end of the line to tell the script that the equation continues on the next line, but nothing I've tried has worked. Could you hlep me out?
Actually "_" is used to
Actually "_" is used to separate lines in VBA/IDEAScript. But to separate strings you have to add "&" to link both lines. Important between "&" and "_" a blank is necessary and will you need additional quotes at the end of the first line and at the beginning of the next line! I hope the following example makes that clearer:
field.Equation = "@if(@Left(" & _
"@Str(YEAR;4;0);1)=""2"";"& _
"""y2k"";""y1k"")"