3 Replies Latest reply on Apr 15, 2016 8:30 AM by bengordon

    Going to Rows and Perfoming Script on Records found in Portals

    bengordon

      I have a portal in my FileMaker database to take attendance and I need to be able to go to a specific row in the portal and mark a student as

      present. I can't do it by portal row number as this based on serial ids because depending on which group is selected , meaning students appear in different row numbers depending on which class is loaded. Please can someone advise as the best way to do this.

       

      I am running FileMaker Pro v14.

       

      Thanks,

      Ben

        • 1. Re: Going to Rows and Perfoming Script on Records found in Portals
          beverly

          Is the portal sorted in a way to easily find a student (such as by name)?

          beverly

          • 2. Re: Going to Rows and Perfoming Script on Records found in Portals
            erolst

            Assuming that you know the id_student (and have it stored in a variable $studentID), and we are talking about a non-filtered portal into an Enrolment table, try this:

             

            Set Variable [ $allIDs ; List ( Enrolment::id_student ) ]

            Set Variable [ $positionInList ; ValueCount ( Left ( allIDs & ¶ ; Position ( allIDs & ¶ ; $studentID & ¶ ; 1 ; 1 ) ) )

            If [ not $positionInList ]

              Show Custom Dialog [ "No student with that ID" ]

            End If

            Go to Portal Row [ by Calculation: $positionInList ]

            […]

             

            If the portal is filtered, you can still do this:

             

            Go to Portal Row [ first ]

            Loop

              Exit Loop if [ Enrolment::id_student = $studentID ]

              Go to Portal Row [ next ; exit after last ]

            End If

            If [ Get ( LastError ) ]

              Show Custom Dialog [ "No student with that ID" ]

            End If

            [ …]

             

            An alternative is to disregard the portal and work directly via a relationship.

             

            Create a global field and use it for a utility relationship, like

            Class::gStudentTemp = Enrolment_byStudentID::id_student, then use a script like

             

            Set Field [ Class::gStudentTemp ; $studentID ]

            Set Field [ Enrolment_byStudentID::flagField ; … ]

            Set Field [ Class::gStudentTemp ; "" ]

            • 3. Re: Going to Rows and Perfoming Script on Records found in Portals
              bengordon

              Thank you! I will try these tonight when I get home.