1 2 Previous Next 16 Replies Latest reply on Dec 4, 2012 1:54 PM by cmspe

    Multiple portals and Refresh Window

    cmspe

      Title

      Multiple portals and Refresh Window

      Post

           I have a layout that does what I want it to do(it keeps track of the laps my class runs on an iPad), but it's not as fast as I would like it to be due to a "Refresh Window" script step.  My layout is based on table "Students" with four portals, each showing 15 students from my class(portal 1 shows records 1-15, portal 2 shows records 16-30, etc.) with table occurence "StudentsbyPeriod" based on the same table "Students".  When you touch on a student's name, it runs a script that adds 1 to a "Laps" field for that student.  I have put a "Refresh Window" script step so that each time you touch on a student, it refreshes the window and you can see the result of the script.  I have tried putting a much faster "Commit Records" script step instead, but you don't see the results until another touch is made in the same portal.  Is there a better way to do this, or am I stuck with using the "Refresh Window" script step?

      Screen_Shot_2012-11-29_at_10.18.58_AM.png

        • 1. Re: Multiple portals and Refresh Window
          philmodjunk

               It's hard to say without knowing more about your design.

               What is the relationship between the layout's table occurrence (Students?) and StudentsByPeriod.

               are the portals filtered?

               a look at the script that increments your Laps field might also help.

          • 2. Re: Multiple portals and Refresh Window
            cmspe

                 The relationship between the layout's table occurrence(Stu_Info) and StudentsbyPeriod is:

                 StudentsbyPeriod::Period=Stu_Info::gPeriod(global)

                 StudentsbyPeriod::TeacherID=Stu_info::gTeacherID(global)

                 The portals are not filtered, but are sorted.

                 The picture below shows the script.

            • 3. Re: Multiple portals and Refresh Window
              philmodjunk

                   Stu_End_Run is neither Stu_info nor StudentsbyPeriod and you have 8 different table occurrences listed that start with that text. )n top of that, you are using a 8 repeating fields at least two repetitions though only repetition 2 is referenced anywhere in the script that you posted.

                   All of that sounds like the cause of your refresh issues. Can you explain what is going on in this script and how these additional relationships work?

                   That's an awful lot of code to just increment a lap counter.

              • 4. Re: Multiple portals and Refresh Window
                cmspe

                     Yes, I do have a lot of code and here is the reasoning.  I wanted one layout that a teacher would go to and select which run they were going to run that day, 1-8, and that would either be 1st semester or 2nd semester.  So there are 16 different possibilities for one layout, hence a lot of code.  If that is the reason for a long refresh time, and I'm talking between .5 sec and 1 sec, than would it be better to create 16 different layouts?  I've put more pictures below to show even more of what I've done.

                • 5. Re: Multiple portals and Refresh Window
                  philmodjunk

                       There are other, far simpler ways to do this that will greatly reduce the amount of calculations and, more importantly, the need for so many table occurrences and this, in turn should result in no such delay on your layout when you tap buttons to update data in the portal rows.

                       I have an incomplete picture of all the tables/relationships involved so what I post next is just a first stab (and one that is likely too simple) at an example of how you might simplify this:

                       Periods-----<StudentRoster-----<Laps

                       Periods::Period = StudentRoster::Period

                       StudentRoster::__pkStudentID = Laps::_fkStudentID AND
                       StudentRoster::gSemester = Laps::Semester AND
                       StudentRoster::gRun = Laps::Run

                       Then your button tap can perform this script:

                       Set Field [Laps::Laps ; Laps::Laps + 1]

                       If my notations used here are unfamiliar, see this thread: Common Forum Relationship and Field Notations Explained

                  • 6. Re: Multiple portals and Refresh Window
                    cmspe

                         I'm stuck with trying the example above.  When I click on students in the portals, it is only adding laps to one student, the student I clicked first(ie. the first created record in table "Laps").  I must be doing something wrong, but haven't figured it out yet.  Any suggestions?

                    • 7. Re: Multiple portals and Refresh Window
                      philmodjunk

                           I did leave out one key detail: gSemester and gRun are fields with global storage specified so that when you select/enter values in these two fields they affect to what record in Laps is accessed in all of your studentRoster records.

                           Did you set these fields up with global storage?

                      • 8. Re: Multiple portals and Refresh Window
                        cmspe

                             Yes, they are both set-up with global storage.

                        • 9. Re: Multiple portals and Refresh Window
                          philmodjunk

                               Is the button that you are clicking inside the portal row?

                               Is the portal based on the correct table occurrence for this simplified design?

                               Are the fields in the portal row from the correct table occurrence?

                               You might show what you now have on your layout with a new screen shot like the original.

                          • 10. Re: Multiple portals and Refresh Window
                            cmspe

                                 The button I am clicking is the StudentName text field made into a button.

                                 Yes, I believe the portal is based on the correct table occurence and the fields in the portal row are from the correct table occurence.  It correctly shows the students and the field laps.

                                 Here is a picture of the new layout with a snapshot of the relationship as well in the middle:

                            • 11. Re: Multiple portals and Refresh Window
                              philmodjunk

                                   The relationship doesn't look right.

                                   It appears you have __pkStudentID, gPeriod, gRun as match fields in StudentsbyPeriod, but have _fkStudentID, Run# and Semester as match fields in RunsbyPeriod.seems like you need to add Period as a match field in RunsByPeriod and gSemester as a match field in StudentsbyPeriod.

                              • 12. Re: Multiple portals and Refresh Window
                                cmspe

                                     I fixed that error, but it's still not working correctly.  The class rosters are showing properly in the portals, but when I check where the laps are going, in another layout, they are going to the first person in the class for that period.  It is not creating a new record in the Laps table except the first record in the portal.  The layout is based on TO Student_Home, the portals are based on TO StudentsbyPeriod and the two fields in the portals are RunsbyPeriod::Laps and StudentsbyPeriod::DisplayName.

                                • 13. Re: Multiple portals and Refresh Window
                                  philmodjunk

                                       Do you see corrrect counts on the layout with the portals?

                                       Can you record different lap counts for each student on that layout?

                                  • 14. Re: Multiple portals and Refresh Window
                                    cmspe

                                         I see counts for the first record and it equals the amount of clicks for any student clicked in the class.  For example, if I click student #35 two times, student #15 three times, and student #52 once, the count for the first record is six.  This is true for that class, even when gRun is changed to a different run number.  It doesn't create new records for each student clicked.  Here is another picture:

                                    1 2 Previous Next