Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.0   7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3    Statistic  

Calendar.SaveReminder

Saves the reminder.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Calendar 3.4 Yes No Yes, macOS only No No

MBS( "Calendar.SaveReminder"; reminderRef )

Parameters

Parameter Description Example value
reminderRef The id of the reminder to query. $reminderRef

Result

Returns OK or error.

Description

Saves the reminder.

Examples

Synchronize Todos with Reminders:

# Sync ToDos as Reminders from FileMaker to Mac Reminder app
# And sync back changes

# Please adjust to your fields and your special use case!
# You can optimize to only update fields on each side if changed
#

Go to Record/Request/Page [First]
Loop
    # Check if we have an ID for this todo already
    If [ToDos::SyncUID  ≠ ""]
        Set Variable [$c; Value:ToDos::SyncUID]
        #Query last modification date
        Set Variable [$completed; Value:MBS( "Calendar.Item.GetCompleted"; ToDos::SyncUID )]
        Set Variable [$datum; Value:MBS( "Calendar.Item.GetDateStamp"; ToDos::SyncUID )]
        If [MBS("isError")]
            # Reminder was deleted, so we recreate
            Set Field [ToDos::SyncUID; ""]
            Commit Records/Requests [No dialog]
        Else
            #Update
            If [$datum > ToDos::Last_Change]
                #
                #Reminder -> FM
                #
                #Sync note field
                Set Variable [$notes; Value:MBS( "Calendar.Item.GetNotes"; ToDos::SyncUID )]
                If [ToDos::To Do Main Text  ≠ $notes]
                    #Special: If note starts with # then move number to duration field
                    If [Left ( Trim ( $notes ); 1) = "#"]
                        Set Variable [$duration; Value:GetAsNumber ( LeftWords ( $notes ; 1 ))]
                        Set Field [ToDos::To Do Completion Time in Minutes; $duration]
                        Commit Records/Requests [No dialog]
                    Else
                        Set Field [ToDos::To Do Main Text; $notes]
                        Commit Records/Requests [No dialog]
                    End If
                End If
                #Sync title if changed
                Set Variable [$title; Value:MBS( "Calendar.Item.GetTitle"; ToDos::SyncUID )]
                If [ToDos::To Do Headline  ≠ $title]
                    Set Field [ToDos::To Do Headline; $title]
                    Commit Records/Requests [No dialog]
                End If
                #Sync completed flag if changed
                If [$completed=1]
                    If [ToDos::flag To Do Completed  ≠ "X"]
                        Set Field [ToDos::flag To Do Completed; "X"]
                        Commit Records/Requests [No dialog]
                    End If
                Else If [$completed=0]
                    If [ToDos::flag To Do Completed  ≠ ""]
                        Set Field [ToDos::flag To Do Completed; ""]
                        Commit Records/Requests [No dialog]
                    End If
                End If
            Else
                #
                # FM -> Reminder
                #
                # overwrite all values
                Set Variable [$r; Value:MBS("Calendar.Item.SetTitle"; $c; ToDos::To Do Headline)]
                Set Variable [$r; Value:MBS("Calendar.Item.SetNotes"; $c; ToDos::To Do Main Text)]
                Set Variable [$r; Value:MBS("Calendar.Item.SetDueDate"; $c; ToDos::To Do Deadline )]
                If [ToDos::flag To Do Completed = "X"]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetCompleted"; $c; 1)]
                End If
                If [ToDos::flag To Do Completed = ""]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetCompleted"; $c; 0)]
                End If
                If [ToDos::To Do Priority="1 Jetzt"]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;1 )]
                End If
                If [ToDos::To Do Priority="2 Sofort"]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;5 )]
                End If
                If [ToDos::To Do Priority="4 Hat Zeit"]
                    Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;9 )]
                End If
                Set Variable [$r; Value:MBS("Calendar.SaveReminder"; $c )]
            End If
        End If
    End If
    If [ToDos::SyncUID  = ""]
        # Create new reminder
        #
        # Which calendar? (Reminder List)
        Set Variable [$CalenderName; Value:""]
        If [ToDos::To Do By="PF"]
            Set Variable [$CalenderName; Value:"ToDo PF"]
        Else If [ToDos::To Do By = "GK"]
            Set Variable [$CalenderName; Value:"ToDo GK"]
        End If
        If [$CalenderName  ≠ ""]
            Set Variable [$c; Value:MBS("Calendar.NewReminder")]
            Set Variable [$r; Value:MBS("Calendar.Item.SetTitle"; $c; ToDos::To Do Headline)]
            Set Variable [$r; Value:MBS("Calendar.Item.SetNotes"; $c; ToDos::To Do Main Text)]
            Set Variable [$r; Value:MBS("Calendar.Item.SetCalendar"; $c;$CalenderName)]
            Set Variable [$r; Value:MBS("Calendar.Item.SetDueDate"; $c; ToDos::To Do Deadline )]
            If [ToDos::To Do Priority="1 Jetzt"]
                Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;1 )]
            End If
            If [ToDos::To Do Priority="2 Sofort"]
                Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;5 )]
            End If
            If [ToDos::To Do Priority="4 Hat Zeit"]
                Set Variable [$r; Value:MBS("Calendar.Item.SetPriority"; $c;9 )]
            End If
            If [ToDos::flag To Do Completed = "X"]
                Set Variable [$r; Value:MBS("Calendar.Item.SetCompleted"; $c; 1)]
            End If
            If [ToDos::flag To Do Completed = ""]
                Set Variable [$r; Value:MBS("Calendar.Item.SetCompleted"; $c; 0)]
            End If
            Set Variable [$r; Value:MBS("Calendar.SaveReminder"; $c )]
            #store id for update later
            Set Field [ToDos::SyncUID; MBS("Calendar.Item.GetUID"; $c)]
            Commit Records/Requests [No dialog]
        End If
    End If
    Go to Record/Request/Page [Next; Exit after last]
End Loop

See also

Example Databases


Calendar.SaveEvent   -   Calendar.SelectEvent

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins