2 Replies Latest reply on Jan 30, 2012 9:55 AM by philmodjunk

    Problems using the Script Manager

    niknek22

      Title

      Problems using the Script Manager

      Post

       Hi'y'all,

      I'm just about tearing what's left of my hair, out! I have spent 4 hours trying to write the simplest of scripts, but I just can't seem to get the syntax right.

      I have a field 'UoM_OD' which is filled via a Value List to be either "Met" or Imp", and depending upon which it is, I need another field 'Tmm' to display either "mm" or "in" respectively.

      I would have thought, from all my research that a script like this should work, but I've tried a multitude of variations without success...

      If [DB_Prep::UoM_OD = "Yes"

      DB_Prep::Tmm = "mm"

      Else DB_Prep::Tmm = "in"

      End If

      Can anyone tell me where I'm going wrong?

      Nik

        • 1. Re: Problems using the Script Manager
          mgores

          If [DB_Prep::UoM_OD = "Yes"

          Didn't you say that the UoM_OD field was either "Met" of "Imp" ?   If so it would never be "Yes" so your DB_Prep::TMM will always be in

          Instead of a script you may want to make DB_Prep::TMM a calculated value using Case (DB_Prep::UoM_OD = "Met" ; "mm" ; "in")

          • 2. Re: Problems using the Script Manager
            philmodjunk

            I'm not sure that you need a script at all for this. You could define the Tmm field as a calculation field with an expression such as:

            If ( UoM_OD = "Yes" ; "MM" ; "in" )

            Tmm could also be a text field and use this expression as an auto-enter expression--which can make it possible to then edit the value in tmm after the fact if you needed to.

            Just to answer your script question, your script could be written to look like this:

            If [DB_Prep::UoM_OD = "Yes" ]
               Set Field [ DB_Prep::Tmm ; "mm" ]
            Else
               Set Field [ DB_Prep::Tmm ; "in" ]
            End If

            When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.