2 Replies Latest reply on Feb 22, 2012 9:15 AM by Kat11_1

    making a script more dynamic

    Kat11_1

      Title

      making a script more dynamic

      Post

      I have a script (triggered on a field on  On Modify) that gets the content of the field in via Script Parameter for which I use Get(ActiveFieldContents).

      The script checks what was old value was and what is the new value.
      If the old value was empty and the new one  is "yes" it timestamps another field.

      This works fine if I use the field names as they are. See below.

      Set Variable [$$OldValue; Value:Get(ScriptParameter)]
      If [IsEmpty($$OldValue) and File Data::Review AgreementTitle = "Yes"  #File Data::Review AgreementTitle is the active field from which the script is triggered and the Script Parameter is passed and has just been modified
         Set Field [ File Data::Review AgreementTitle_Date; get(CurrentDate)]
      Else If [not IsEmpty($$oldValue) and File Data::Review AgreementTitle = ""
         Set Field [ File Data::Review AgreementTitle_Date; ""]
      End If


      I would like to make the script more dynamic so I can use it on more than one field without having to create another script and changing the actual field names in it and use Get(ActiveFieldTableName)&"::"&Get(ActiveFieldName) in place of File Data::Review AgreementTitle
      and
      Get(ActiveFieldTableName)&"::"&Get(ActiveFieldName)&"_Date"
      in place of the field that needs to get the date stamp.

      As per Data Viewer I get the correct names but the script doesn't recognize when the criteria is met. I hope I am missing something and that this can be done. As always I look to you for help.

      K