4 Replies Latest reply on May 12, 2015 8:17 AM by Stu412

    Calendar - adding events to existing events list

    Stu412

      Title

      Calendar - adding events to existing events list

      Post

      I have a calendar which I've downloaded and been able to integrate to my FM database and in turn, tie this in against my Work table which holds records of projects against customers.

      The primary method to add a project against a customer is from the customer parent layout with a portal to the work table.  This in turn shows up on the calendar and you can view it there.  Each day on the calendar is built via a portal linking back to my Work table - the calendar itself is built on the Weeks table which show the dates it'll need.  

      I cannot pretend to know exactly how it works at this point which I think is the cause of my question.

      For this to be super slick, I want to add events directly on the calendar screen, but there are issues.

      1) I cannot create new events, but I can modify existing events.  The relationship is set to allow new records to be added, but if I click the portal it says it's not modifiable.

      2) If I could add new events, I'd need to know who the customer is.  On existing events, this is dealt with via the relationship between the Work and Customer table.

      A couple of issues and a rambling post....

      Thanks in advance!

        • 1. Re: Calendar - adding events to existing events list
          philmodjunk

          Your reference to a "weeks" table suggests that it's my calendar example that you are working with. Is it?

          https://www.dropbox.com/s/e8d03xvwe8vtz85/Calendar.fp7

          It uses a Weeks table where there is one record for each week of the year in a list view with 7 portals that show events for Sunday - Saturday of the same week.

          These are filtered portals that filter by day of the week from the date field in the events table. Since the dates field is not visible in the portal itself (which would be redundant on a calendar) you don't have the fields that you'd need to create an event record let alone link it to a specific customer.

          I suggest adding a button or buttons that either open a small modal window or (better) a popover where you can enter the needed data--including a drop down list or pop up menu of customers with customer ID's and names, into global fields and then a "save" button in the window or popover creates the new events record and transfers the data from the global fields into the new event record.

          • 2. Re: Calendar - adding events to existing events list
            Stu412

            Hi Phil

            Good spot, it's a cool calendar and great to work with, thanks for sharing.

            I've got to the point of a popover - it's able to use this to expand an entry on the calendar and view the details behind the 'header' (portal row field), which in this case is the customer name.  On the same row, you click a button and the popover explodes out.  You're able to edit the work, change the dates etc so it moves around the calendar.

            I've tried using the button method previously as you've suggested but the sequence of events was to click this button, see the popover, go to enter details and then fail.  It would fail with the same message that the field could not be modified.

            If I understand correctly, I'd normally see that message when I try to type directly to a calculated field.

            I'm not certain whether FM has created the record or not at this point, or has failed part way through on its attempt to write a new record to the Work table.  It's odd that I can use exactly the same popover on the customer record to add projects, but not via the calendar.  I just wonder if the Events::cDate to Weeks join is the issue here (seeing as the cDate wouldn't be a value until I enter something)?  That's a guess based on pure supposition and the position of the moon...

            Thanks in advance

             

            • 3. Re: Calendar - adding events to existing events list
              philmodjunk

              This isn't what I am suggesting for adding a NEW event to the calendar.

              This popover would be outside the portal and you'd put global fields on it for each field needed for one of your events. A "save" button placed inside the popover would run a script like this:

              Go to Layout ["events" (Events)]
              New Record/Request
              Set Field [Events::EventDate ; globals::gEventDate ]
              Set Field [Events::CustomerID ; globals::gCustomerID]
              add as many set field steps as you have global fields in the popover
              Go to layout [original layout]

              You could set up one popover in the header for the entire calendar or individual popovers for each day of the week portal. If you use this second approach, an OnObjectEnter trigger set on the Popover panel could enter the date for that day of the week into the global date field for you.

              • 4. Re: Calendar - adding events to existing events list
                Stu412

                Aaaaaaahhhhh.......

                 

                That'll do it.  Thanks wise one ;)