6 Replies Latest reply: Sep 21, 2012 10:20 AM by Robert Hutchings RSS

    Question on Scripting

       

        What could be the problem with this script ?

       

       

       

      =if(if(Style='TVB' and if(DISPLAY_YEAR='2007',0,(If(DISPLAY_YEAR='2008',1,If(DISPLAY_YEAR='2009',2,If(DISPLAY_YEAR='2010',2,If(DISPLAY_YEAR='2011',3,4)))))),

      if(if(Style='RY903C' and (If(DISPLAY_YEAR='2008',0,If(DISPLAY_YEAR='2009',1,If(DISPLAY_YEAR='2010',3,If(DISPLAY_YEAR='2011',4))))),

      if(Style='RUSSA1' and If(DISPLAY_YEAR='2010',0,If(DISPLAY_YEAR='2011',1,If(DISPLAY_YEAR='2012',2)))

      Regards

      Mhatim

        • Re: Question on Scripting
          Stefan Wühl

          At first glance, some missing brackets (about 4-5 closing)? Then, some of your conditionals are missing a then branch, wich is mandatory.

            • Re: Question on Scripting

              Thanks for your response

              I have changed the If statement to take care of all the conditionals however

              When I complete the brackets this what I get

                                                                                                                                                                                         Red underline comes before the third bracket at the end.

              Please advise.

               

              =if(if(Style='TVB' and if(DISPLAY_YEAR='2007',0,(If(DISPLAY_YEAR='2008',1,If(DISPLAY_YEAR='2009',2,If(DISPLAY_YEAR='2010',2,If(DISPLAY_YEAR='2011',3,4)))))),

              if(Style='RY903C' and (If(DISPLAY_YEAR='2008',0,If(DISPLAY_YEAR='2009',1,If(DISPLAY_YEAR='2010',3,If(DISPLAY_YEAR='2011',4))))),

              if (Style='RUSSA1' and If (DISPLAY_YEAR='2010',0,If(DISPLAY_YEAR='2011',1,If(DISPLAY_YEAR='2012',2)))))))

                • Re: Question on Scripting
                  Mayil Vahanan Ramasamy

                  HI

                   

                  Try this,

                   

                  =if(if(Style='TVB' and if(DISPLAY_YEAR='2007',0,(If(DISPLAY_YEAR='2008',1,If(DISPLAY_YEAR='2009',2,If(DISPLAY_YEAR='2010',2,If(DISPLAY_YEAR='2011',3,4))))),

                  if(Style='RY903C' and (If(DISPLAY_YEAR='2008',0,If(DISPLAY_YEAR='2009',1,If(DISPLAY_YEAR='2010',3,If(DISPLAY_YEAR='2011',4))))),

                  if (Style='RUSSA1' and If (DISPLAY_YEAR='2010',0,If(DISPLAY_YEAR='2011',1,If(DISPLAY_YEAR='2012',2))))))))

                   

                  But some condition is missing in some if statement..Please fill it

                  • Re: Question on Scripting
                    Stefan Wühl

                    Hope I got correctly what you are trying to achieve:

                     

                    =if(Style='TVB',if(DISPLAY_YEAR='2007',0, If(DISPLAY_YEAR='2008',1,If(DISPLAY_YEAR='2009',2,If(DISPLAY_YEAR='2010',2,If(DISPLAY_YEAR='2011',3,4))))),

                    if(Style='RY903C',If(DISPLAY_YEAR='2008',0,If(DISPLAY_YEAR='2009',1,If(DISPLAY_YEAR='2010',3,If(DISPLAY_YEAR='2011',4)))),

                    if(Style='RUSSA1',If(DISPLAY_YEAR='2010',0,If(DISPLAY_YEAR='2011',1,If(DISPLAY_YEAR='2012',2))))))

                • Re: Question on Scripting
                  Robert Hutchings

                  Should you start with two if's (i never do)

                   

                  =if(Style='TVB' and DISPLAY_YEAR='2007',0,

                   

                  etc

                   

                  its

                   

                  if(a=b and / or c=b etc,then (may include an if), else (may include an if)

                   

                  if you have more than one if statement the brackets are all maybe closed at the end not part way through

                   

                  not

                   

                  If(DISPLAY_YEAR='2011',3,4)))))),

                   

                  try dropping all if if statement

                   

                  I don't think this will work at any point in the formula


                  if(if(Style='RY903C' and

                   

                  its always if,then,else not if(if

                   

                  I believe