5 Replies Latest reply on Oct 21, 2013 10:35 AM by philmodjunk

    portal data entry on top



      portal data entry on top


           Hi guys!


           Im using a portal to be able to keep track of rent incomes. please see the attached image for what I got so far.

           It works great except for the fact that the newest month (the last added) should be at the top, so I sorted descending on my creating date, problem solved.

           BUT my portal ato adds a new record when a new record is committed and adds the new record to the bottom of the portal.....

           I guess you'll understand my problem when I tell you I would like filemaker to add it to the TOP of the portal instead of the bottom.

           How can I achieve this? Thanks!


        • 2. Re: portal data entry on top

               Thanks Steve, thats what I need indeed.

               However I cant seem to figure out the script that I need to connect with the button to add a new portal record....




          • 3. Re: portal data entry on top

                 You'll need to substitute your names for mine:

                 Set Variable [$ID ; LayoutTableOccurrence::PrimaryKey ]
                 Go to layout ["PortalTable" (PortalTable) ]
                 New Record/Request
                 Set FIeld [ PortalTable::ForeignKey ; $ID ]
                 GO to Layout [original layout]

                 And note that any script that changes layouts could trip a number of different script triggers if such have been set up on either layout.

            • 4. Re: portal data entry on top

                   Hi Phil,

                   We choose to do this a different way and create years with months in advance so we only need to enter the data in the predefined rows.

                   I have attached an image how we would like the data to appear.

                   I have thought of a way to create this with portal records but could not find a way to predefine the 12 months and the 5 years (we would like to be able to add or remove years easily to all records) and link everything so we can use searches and compare rents etc.

                   AND is it possible to hide all this if the "status" field is NOT "rented" or something similair. In other words can you hide or not make fields, portal etc appear at all based on a calculation?

                   I wonder if you have a great way to do this? thanks in advance!

              • 5. Re: portal data entry on top

                     I would not use tabs for the years. There's no simple way to add more years with that approach and you have to redesign your  layout each time you want to change the tabs.

                     But your portal can be controlled by  a drop down list set on a field with global storage where you select and existing year or enter a new one. An OnObjectSave trigger can perform a script that creates the needed 12 records if they do not already exist.

                     If [ IsEmpty ( RelatedTable::Date ) // only true if portal is empty ]
                       Freeze Window
                       Set Variable [$PrimaryKey ; LayoutTable::PrimaryKey ]
                       Go to Layout ["PortalTable" (PortalTable)]
                          Set Variable [$Month ; $Month + 1 ]
                          Exit Loop if [$Month > 12 ]
                          New Record/Request
                          Set Field [ PortalTable::Date ; Date ( $Month ; 1 ; LayoutTableOccurrence::GlobalDropDownYearField ) ]
                          Set Field [ PortalTable::ForeignKey ; $PrimaryKey ]
                       End Loop
                       Go to Layout [ original layout ]
                     End If

                     The relationship for the portal might look like this:

                     LayoutTableOccurrence::PrimaryKey = PortalTable::ForeingKey AND
                     LayoutTableOccurrence::GlobalDropDownYearField = PortalTable::cYear

                     cYear would be a calculation field defined to return the year: Year ( Date )