1 Reply Latest reply on Jan 23, 2012 10:16 AM by philmodjunk

    Need Script Help

    LASLF

      Title

      Need Script Help

      Post

      I have two tables:  Tracker - to track items we are collecting data for;  and Data Worksheet - to enter the data on.  They are related by an item number.

      When we start working on a new item, we add a record to the tracker to monitor its progress through our process.  We also create a record on the data worksheet to fill in as we collect data for the item.  We switch between these layouts numerous times through the research process.

      I would like to set up a button on the Tracker layout to go to the corresponding record on the Data Worksheet layout, and to create a new record in the Data Worksheet layout if one doesn’t already exist.  I already have a button that will take me from the Data Worksheet layout back to the tracker.

      Don’t know how to write the [conditional] script.  Can someone help?  Thanks!!

        • 1. Re: Need Script Help
          philmodjunk

          Tracker::ItemNumber = Data Worksheet::ItemNumber

          is how I interpret the relationship between these two tables.

          If you enable the "allow creation of records via this relationships" check box for Data WorkSheet in the above relationship, this one line script will create a new related Data WorkSheet Record from the Tracker layout if one does not already exist. If it does exist, nothing will change in your database:

          Set Field [Data Worksheet::ItemNumber ; Tracker::ItemNumber]

          If you need to then go to a layout that displays the related Data Worksheet record, do it this way:

          Set Field [Data Worksheet::ItemNumber ; Tracker::ItemNumber]
          commit Record
          Go To Related Record [Show only related records; From table: Data WorkSheet; Using layout: "Data WorkSheet" (Data WorkSheet)]