3 Replies Latest reply on Apr 4, 2017 10:12 AM by philmodjunk

    Reference active Field in a Portal

    ngoeller

      I apologize if I've put this post in the wrong place, I'm new here.

      I have a form where I need to enter the current time a lot, each reading requires a time.

      I have a portal with records for each field visit, each portal row may have 3 to 5 time readings for measurements.

      so to save time I wanted the time field to auto-populate on activation, so when the field is selected (on an iPad) it drops in the current time.

      what I wanted to have was a script, on activation, which reads the active field, checks if it's empty (so the time is not constantly overwritten)

      and if empty puts in the current time.

       

      I have tried :

      I tried

      If [IsEmpty ( Get ( ActiveFieldTableName ) & "::" & Get ( ActiveFieldName ) ) ]

      but it doesn't get into that loop.

       

      I also tried setting a variable to test for isblank

      Set Variable [$test; Value: Get ( ActiveFieldTableName )&"::"& Get (ActiveFieldName)]

      if [IsEmpty ( $test) ]

      but isempty doesn't seem to see the variable as an adress.

       

      any help would be greatly appreciated, it would save having 1 script for every time cell..

        • 1. Re: Reference active Field in a Portal
          philmodjunk

          You would need to modify your current calculation to be:

           

          If [IsEmpty ( GetField ( Get ( ActiveFieldTableName ) & "::" & Get ( ActiveFieldName ) ) ) ]

           

          but

           

          If [ IsEmpty ( Get ( ActiveFieldContents ) ]

           

          would be much simpler.

           

          each portal row may have 3 to 5 time readings for measurements.

          suggests that there may be a better way to do this so that you get one time entry per portal row instead of trying to record several on the same row.

          1 of 1 people found this helpful
          • 2. Re: Reference active Field in a Portal
            ngoeller

            thanks so much, this will save me a lot of pain.

             

            I will look into restructuring as you suggest, but right now I'm trying to keep each field visit to the site as one record, because each time is for a different measurement taken during one visit.  I am betting once this is done I'll realize the wisdom in your suggestion.

            • 3. Re: Reference active Field in a Portal
              philmodjunk

              What you can do is have one record for each visit, but with a related table linked to that table of visits for recording the time values. This is more flexible because you can then record any number of time values in a given visit--thus allowing for changes in procedure that might require a different number of values for a single visit without having to redesign your solution to allow for more time values in a given visit.