1 2 Previous Next 17 Replies Latest reply on Mar 23, 2017 8:49 AM by philmodjunk

    Help to correct a simple script

    akhlaq38

      Please see the script below and suggest mistakes. The purpose is to post entries of 2 fields from a portal table row to an other tables's mentioned fields. Now the fields 1 and 2 are mandatory so a record will be created but field 3 and 4 may have data or empty. If they have data, a second record should be created but if they are empty script should do nothing more.

      Following script is working up to line 8 but do nothing if even there is data in field 3.

      1 Set variable [$B_1; value: table1::Field1]

      2 Set variable [$Q_1; value: table1::Field2]

      3 Set variable [$B_2; value: table1::Field3]

      4 Set variable [$Q_2; value: table1::Field4]

      5 Go to Layout  ["table2" (table2)]

      6 New Record / Request

      7 Set Field  [Table2::FieldX; $B_1]

      8 Set Field  [Table2::FieldY; $Q_1]

      9 If [not IsEmpty (Table1::Field3)]

      10   New Record /Request

      11   Set Field [Table2::FieldX; $B_1]

      12   Set Field [Table2::FieldY; $Q_1]

      13 EndIf

      14 Go to Layout [orignal layout]

       

      If I delete rows 9 and 13 it will create a second record with or without data. Need to fix If statement to put properly.

      I am using a button in the portal row to run the script.

        1 2 Previous Next