13 Replies Latest reply on Feb 21, 2012 10:40 AM by philmodjunk

    two dimensional array

    med

      Title

      two dimensional array

      Post

      Is there any way to simulate a two dimensional array. I need to create a variable with two dimensions and populated it with calculated values from a source table then transpose it to a table for display as a portal. 

      I tried to use a one dimensional array fill it then create a record and copy its elements to the fields then repeat in a loop but this involved a lot of record navigation in the source and destination tables to get the values and the operation was very slow especially when I am doing it over a network. 

      I think if I scan the source table once and fill in the calculated values in the proper elements of a two dimensional array, it would be much faster.

      The purpose is a booking application where I read an appointment list table (not in order) and transpose it to a grid of data in a temporary table where each row is a time slot and each column is for one teacher. Then I display this table as a portal.Each element of the portal has a hidden button which when clicked the detailed information of the appointment is displayed.

      Please help ... or may be there is a better way to do this.

        • 1. Re: two dimensional array
          philmodjunk

          I think you can get what you want with a set of portals with portal filters to get your columns of data. That will avoid the scripted data manipulation you are describing here.

          • 2. Re: two dimensional array
            med

            I thought of that at the beginning but I dismissed it because I do not know how to gang the partals. They will be displayed side by side and the time headings to the left, I will need to do something about scrolling, if I scroll one portal I need all the others to move accordingly so all will be located at the same time slot.

            IF I CAN DO THAT IT WILL BE GREAT. Can you give me a hint.

            Thank you.

            • 3. Re: two dimensional array
              med

              I thought I include an image of the screen I am talking about so I am very clear

              • 4. Re: two dimensional array
                med

                here it is

                • 5. Re: two dimensional array
                  med

                  I failed to send you an image sorry

                  • 6. Re: two dimensional array
                    philmodjunk

                    images must be of type jpg, gif or png. Any other formats will not appear in the forum when you upload them. (You can upload them to a file share site though and post the download link here in your next post.)

                    • 8. Re: two dimensional array
                      philmodjunk

                      Can you try that again with a larger image? Even when I zoom in, I can't read the column headers to figure out what kind of data you are entering and what determines which column should display a particular value.

                      • 9. Re: two dimensional array
                        med

                        hopefully this is a larger image

                        • 10. Re: two dimensional array
                          med

                          It came out to be the same size I do not know why but any way the headings of the columns are the teachers names and along the left side are the times 3:00, 3:15, 3:30 etc and in the grid the appointments are displayed with the student name on top and the colored appointment spans as many time slots as needed so if the appointment is 45 minutes it spans 3 slots because each time slot is 15 minutes

                          • 11. Re: two dimensional array
                            med

                            to explain more, when you click on any appointment there is a hidden button which runs a script to calculate the time and teacher, in other words it identifies the appointment. Then the buttions at the top will do different processing for that appointment. Like cancel or move or copy ... etc.

                            • 12. Re: two dimensional array
                              med

                              to explain more when you click on any slot there is hidden button twhich runs a script to identify the time and teacher. then the buttons on top allow you to do different processing for that tims slot like book or cancel etc.

                              • 13. Re: two dimensional array
                                philmodjunk

                                When I click on it. It's much larger when it opens and easy to read. Thank you.

                                Do you have this relationship?

                                People----<People_appointment>------Appointments

                                People::PeopleID = People_appointment::PeopleID
                                Appointments::ApptID = People_appointment::ApptID

                                If so, you can set up a filtered portal for each person to get your columns of appointments. Let's add this table to the mix:

                                TimeSlots>--Appointments----<People_Appointment

                                TimeSlots::Date = Appointments::Date AND
                                TimeSlots::Time > Appointment::StartTime AND
                                TimeSlots::Time < Appointment::EndTime

                                Now you can create a list view layout based on TimeSlots. Each row in your screen shot would be one record and each intersection of Teacher and time slot is a one row filtered portal to Appointments. You can perform finds to pull up the schedule for any given day or range of dates and times.

                                For the first column, your portal filter might be:

                                People_Appointment::PeopleID = 7 // 7 is ID number for "Barbara Ferchuk"

                                The second column portal is identical to the first, but you use a different ID number to show appointments for Brooke Foster and so forth.

                                Note that you can use global variables or fields in place of the literal ID numbers. Then you can turn the column headers into pop up menus to use to select a person for that column of filtered portals.