1 2 Previous Next 16 Replies Latest reply on Jan 25, 2011 1:40 AM by xtremu

    Can't create next row in the portal

    xtremu

      Title

      Can't create next row in the portal

      Post

      Hi guys please help,

      I am using Filemaker Pro 11 advanced and I want to add second, third, fourth .... or up to 1000 rows in the portal.

      This is to monitor and record the time of the students (entry and leaving ) thecampus in the "TimeIn" and "TimeOut" field based on the Access Logtable/layout.

      I have only twotables: Student table/layout andAccess Log table/layout  

      Relationship isStudent::StudentID=Access Log::StudentID

      Below is the script and picture of the first and second entry of the student with TIME in (TIME In & TIME Out field) and that's ok but the third , fourth and so on entry got trouble, I cannot create another/next  portal row that hold/display  the time (TIME In & TIME Out field). If I made another entry, let's say third and fourth entry it only update the time in TimeOut field of the portal, it did not create another row which I need to do. I tried any suggetion in the forum but i can't figure out. I am new in scripting.

      Thanks for the big help, more power FM.

       

      time%26script.jpg

        • 1. Re: Can't create next row in the portal
          Abhaya

          hello,

          Just listen and check in its database..

          the portal coming from the table must check its Allow creation of record via this relationship.

          what happens in ur case is you did portal setup having only 2 rows so while  you are entering the third value the 1st value is removed from portal list(still in table)and show for 3rd value entry.

          so just increase the no of rows in portal then see..

          I think this'll bring ur  solution

          • 2. Re: Can't create next row in the portal
            xtremu

            Thanks Abhaya, I tried your suggestion to add or increase row in the portal: initial row=1, number of rows=5 or 10 or 15 but it does'nt work still it only update the time in the "TimeOut" field of the portal and it stuck there. If I type the time manually in the "TimeIn and TimeOut" filed it works and it create another row/s up to how many rows you want. I used to find the record/student through his/her student number, type it in the StudentNumber field and link it to the Access Log portal and record the system time in the "TimeIn and TimeOut" field and that's what im trying to figure out. 

            For example in the first row of the portal, if their is already a time in the "TimeIn and TimeOut" field then make another row and record the time in the TimeIn field as their 3rd entry, then TimeOut for their 4th entry and so on. The picture above created already another or second row but the time did'nt show in the TimeIn and TimeOut field, something missing with the script or missing the configuration or links?

            Thanks in advance.

            • 3. Re: Can't create next row in the portal
              Abhaya

              hello,

              ok you want to display the time  when a student'll enter.

              Just follow this steps...

               u hv x and y two fields in the portal.

              x:-write script if student id exist then go to this x field.... e.g set field(x,value get current time) then set field(y,null)

              similar for y but after time sets then just add another line go to portal row next.

              u hv to add with script trigger that after y set the portal must go to next row..

              k.. try this ............

              • 4. Re: Can't create next row in the portal
                xtremu

                Thanks again Abhaya, you got what i mean and I try to follow your suggestion but i can't figure out. Im stuck in "TimeOut" field of the portal and it only update the time of the "TimeOut" field when i enter the student number of the student for third, fourth etc. entry. Go to Portal row (next) doesnt work. 

                I have script on my first post, please add some missing code for it. Im sorry for the late reply and hopefully you can help me solve this problem.

                Thanks again and more power

                • 5. Re: Can't create next row in the portal
                  Abhaya

                  Hi,

                  pls check is this u r searching for

                  student and access layout

                   u r in access layout and displying TIME IN  and TIME OUT  of each student.

                   the time in and time out value is already entered for student means when 1student entered it keeps its time as TIME IN

                   and when another student enter it puts the 1st students TIME OUT  value.

                  and this value must be shown in  Accesslayout by the portal, checking if student id is exist.

                                                   ............... OR............

                   u r entering value through portal by add button means..

                  click add button if there is no student

                  then it takes to student layout form view, fill the all field values and come to the corresponding portal.then it shows the entry time  in TIME IN field when student login (means when the student id create) and  the time when exit from the student layout in TIME OUT field.similar process for more entry

                  pls ans  i am waiting........

                  • 6. Re: Can't create next row in the portal
                    xtremu

                    Abhaya,

                    Student and Access layout

                    Relationship is Student::StudentID=Access Log::StudentID

                    Student Table/Layout

                    Access Log Table/Layout

                    Objective: 1. To monitor and record the time of each student entry in the TimeIn and TimeOut field in the portal base on the Access Log Layout shown in the Student Table Layout.

                    Note: - Every student has their own record/information in the database such as Name, LastName,  

                                 FirstName, StudentNumber, picture etc..

                             - TimeIn and TimeOut are fields in portal from AccessLog table which shown in the Student Table.

                             - Every student has their own ID with barcode: (barcode=student number)

                    Scenarios:

                    I am in Student Layout displaying the fields which contain information of student, (student number, first & last name etc.., and the TIME In and TIME Out fields of portal base on Access Layout  are also there in Student Layout . Let’s start without value (time) of all the student record and let’s say we have 3 records of students store in our database.

                    FIRST Activity.

                    If

                    First, second, third student: first entry (scan IN or manually enter) of  the student number in the STUDENT NUMBER field in the Student Layout should (then) create new record (time) in the Access Log table and set that time and shown in TIME IN field of the portal.

                    and

                    (Second Activity.)

                    First, second, third student: second entry (scan IN or manually enter) of  the student number in the STUDENT NUMBER field in the Student Layout should (then) create new record (time) in the Access Log table and set that time and shown in TIME OUT field of the portal.

                     Else

                    (Third Activity.)

                    First, second, third student: third entry (scan IN or manually enter) of  the student number in the STUDENT NUMBER field in the Student Layout should (then) create new/second row and record (time) in the Access Log table and set that time in the second row and shown in TIME IN field of the portal.

                    and

                    (Fourth Activity.)

                    First, second, third student: fourth entry (scan IN or manually enter) of  the student number in the STUDENT NUMBER field in the Student Layout should (then) create new/second row and record (time) in the Access Log table and set that time in the second row and shown in TIME OUT field of the portal.

                    Loop these activities up to the how many entries or up to the last entry of that student or that certain record.

                    I have script on my first post for your reference; please add some missing code for it.

                    Again, I’m sorry for my late reply and hopefully you can help me solve this problem. Am waiting.

                    Thanks again and more power.

                    xtremu

                    • 7. Re: Can't create next row in the portal
                      Abhaya

                      Hi,

                      Just  Do it..

                      student & Access both related by ID

                      Make a Table Occurance(TO) Of Access and relate with Student by constant field (value =1 by calculation)

                      In student layout

                      add the fields values in browse mode

                      add a script trigger on object exit with the last field in  this layout

                      Draw a portal that comes froms  Access TO which must hv 2 fields Time In and Time Out

                      script:

                      if (notempty=Student_ID)
                       set var($x=Student_ID)
                       if(Mod($x;2!=0))
                          go to Access layout
                          new record
                          Set field(Access_kfid=$X)
                          set var($T=get current time)
                          set field(Access_Timein=$T)
                          set field(Access_Timeout=Null)
                            if($x=1)
                            go to original layout
                            else
                            go to previous record
                            set field(Access_Timeout=$T)
                            go to original layout
                            endif
                        else
                        go to Access layout
                        new record request
                        Set field(Access_kfid=$X)
                        set var($T=get current time)
                        set field(Access_Timein=$T)
                        set field(Access_Timeout=Null)
                        go to previous record
                        set field(Access_Timeout=$T)
                        go to original layout
                        endif
                      endif

                      The portal setup must hv vertical scrollbar

                      and each relationship Check in  Allow creation of record in this table.(In child side)

                      I thinks this is going to be your exact ans.....

                      • 8. Re: Can't create next row in the portal
                        xtremu

                        Thanks again Abhaya, I try to copy the procedures or steps of your script based on the tables and fields that I have.Upon entering the student number manually in the Student Number field nothing display in the "TimeIn and TimeOut" field of the portal . Im happy that yout got what I wanted to do but I think not lucky to follow the procedures and maybe something wrong with my code especially setting up variables/fields like ($X=Student_ID,$X;2!=0, Access_kfid=$X, etc..). Please guide me how to do that using my tables and fields below.

                        Student Table                                                             Access Log Table

                        Student ID - Number - Autoserial                               Student ID - Number - indexed

                        Student Number - Number - indexed                         Time In - Time

                        Last Name - Text                                                        Time Out - Time

                        First Name - Text                                                         Record ID - Number

                        etc..                                                                            Log ID - Number

                        Relationship is Student::Student ID=Access Log::Student ID / Allow creation of records in this table via relationship is already enable or checked.

                        Thanks again

                        • 9. Re: Can't create next row in the portal
                          Abhaya

                          hello,

                          Mod function returns the remender value.when i put(Mod($x,2)!=0)

                          if this is first record then $x=1,Mod()...returns 1 which is not equal to 0.if $x =2 then Mod value is 0.

                          Actually I Kept the Braces in wrong place ok Sry.

                          Now i am just describing the process

                          1st create a record in student  layout(student ID=1) keep it in $x then fill the other fields as i told set a trigger on the last field in this layout that means when u exit/save from the last field that script 'll run..

                          it goes to access layout with $x=1

                          here it create new record  and paste the Student id as foreign key then set time in field as current.

                          when it exit from the script then only it shows the time in the portal....

                          For rest u just go through script debugger..............

                          Record Id and Log Id both fields are necessary or not  I do't know but kf student id must be there.

                          Just check the Mod function andAll the later prefix With $ are variable....

                          So pls check these thing I hope   Now  after u should't hv any more doubt.

                          Thanks,

                          Nice for ur Response

                          • 10. Re: Can't create next row in the portal
                            xtremu

                            Hi, thanks for the ideas, I just noticed that this script created already next row in the portal after setting up the system time in the "TimeIn and TimeOut" field for the first and second entry respectively.

                            Can you please help me add the missing code for this script of saving the time in the portal field and then set the time in the next row of the portal for their third, fourth and etc. entries?

                            Freeze Window

                            Loop

                            Go to Field [Student::Student Number]

                            Pause/Resume Script [Duration (seconds): 2]

                            Enter Find Mode [Pause]

                            Set Variable [$studentID; Value:Student::Student ID]

                            Perform Find []

                            Go to Layout [“Student’’(Student)]

                            Set Field [AccessLog::Student ID[$StudentID]]

                            Set Error Capture [On]

                            Sort Records [Restore; No dialog]

                            If [IsEmpty (AccessLog::TimeIn)]

                            Set Field [AccessLog::TimeIn; Get (CurrentTime)]

                            Else

                            Set Field [AccessLog::TimeOut; Get (CurrentTime)]

                            End If

                            End Loop

                            Thanks Abhaya

                            • 11. Re: Can't create next row in the portal
                              Abhaya

                              Hello,

                              This script can't create new portal row

                              No doubt it sets the time but in a single row.

                              means for 1st same row for 2nd also same row bcoz

                              For each ID it is displaying its time .

                              so just change that script and for thhe script given by me.

                              • 12. Re: Can't create next row in the portal
                                xtremu

                                hi,

                                Really? thanks for the advice, I tried to incorporate your script to my tables and fields which I previously posted but no system time set and shown in the portal fields ("TimeIn and TimeOut"). I am totally new in scripting, please correct my script below which one made a mistakes. This is a big favor for you, can you please finalize this script by using my tables and fields. 

                                Go to Field [Student::Student Number]

                                Enter Find Mode [Pause]

                                Set Error Capture [On]

                                Perform Find []

                                Go to Layout [“Student” (Student)]

                                If [IsEmpty (Student::StudentID)]

                                Set Variable [$X]

                                If [Mod ($X; 2)]

                                Go to Layout [“Access” (Access)]

                                New Record/Request

                                Set Field [Access::Access_kfid; $X]

                                Set Variable [$T]

                                Set Field [Access::TimeIn; $T]

                                Set Field [Access::TimeOut; “Null”]

                                If [$X=1]

                                Go to Layout [original layout]

                                Else

                                Go to Record/Request/Page [Previous]

                                Set Field [Access::TimeOut; $T]

                                Go to Layout [original layout]

                                EndIf

                                Else

                                Go to Layout [“Access” (Access)]

                                New Record/Request

                                Set Field [Access::Access_kfid; $X]

                                Set Variable [$T]

                                Set Field [Access::TimeIn; $T]

                                Set Field [Access::TimeOut; “Null”]

                                Go to Record/Request/Page [Previous]

                                Set Field [Access::TimeOut; $T]

                                Go to Layout [original layout]

                                EndIf

                                EndIf

                                Thanks Embarassed

                                • 13. Re: Can't create next row in the portal
                                  Abhaya

                                  Hi,

                                  I think loop.enterfind mode ,perform find are not required so just omit thesse things  and start with   set variablles ok follow my script.

                                  student and Access r 2  tables.

                                  Create a field constant1  in both Student and Access table whose type is calculation and value is 1.

                                  Make a duplicate of Access table and relate it with Student by Constant1. (Rename it as: student_Acceslog__Constant1)

                                  Then in Student layout draw a portal  that comes from student_Acceslog__Constant1 table and see the output.

                                  • 14. Re: Can't create next row in the portal
                                    xtremu

                                    Hi Abhaya,

                                    I followed your suggestion to remove those things and created new field and duplicate it to both tables with a value of 1 and draw portal in the student table, it works now. It created new row and set the time in TimeIn and TimeOut field but not really refined because the time set in the TimeIn is also the time set in TimeOut field of the portal and it appeared simultaneously.

                                    I want to have a record for each student entry, (record the TimeIn and TimeOut individually), can you please help me add code for this? Below is the output of the code you suggested.  Note: I have only 3 students in my database and I made 3 entries for testing purposes.

                                    Time In

                                    Time Out

                                    12:15:07 PM  = 1st

                                    12:15:11 PM

                                    12:15:11 PM  = 2nd

                                    12:15:14 PM

                                    12:15:14 PM  = 3rd

                                    12:15:19 PM

                                    12:15:19 PM

                                     

                                    Thanks..

                                    1 2 Previous Next