We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

schedule and Sqlite and other questions

Thread ID:

Created:

Updated:

Platform:

Replies:

145136 Jun 8,2019 04:06 PM UTC Jun 18,2019 11:39 AM UTC Xamarin.Forms 7
loading
Tags: SfSchedule
phil
Asked On June 8, 2019 07:47 PM UTC

Hi All just wondering if someone can tell me the best way to save appointments to sqlite database and recall them back.
I'm using a similar approach to your Appointment Editor in the demo to produce the schedule.
Also If recursive appointments are set will it make separate Db rows or just one with recursive rule.

Any help would be great..

Subburaj Pandian Veluchamy [Syncfusion]
Replied On June 10, 2019 11:58 AM UTC

Hi Phil, 
  
Thank you for contacting Syncfusion support. 
  
Query 1: Regarding Schedule with SQLite database 
Schedule supports to load and retrieve appointments from SQLite database. We have published a KB documentation for the same. Kindly refer our KB documentation to know more about loading the data from SQLite database into schedule. 
 
  
Query 2: Regarding database row count for recursive appointments 
For recursive appointments single appointment with recurrence rule is enough, separate rows are not needed in the database. 
  
We hope this helps, kindly revert us if you have any concern. 
 
Regards,
Subburaj Pandian V
 


Phil
Replied On June 11, 2019 08:30 AM UTC

Thank you for the reply. 

Sorry to pester you more but I'm still wondering the best way to SAVE the appointments to SQLite when a single appointment has been changed or added. 

Also I'm a bit worried that this could be a problem when a lot of appointments are in the database (What do you think?), could load on demand be utilises with this approach ( I have no idea how to do this, only collecting SQLite data when needed , could you help?).

My question about recursive is an issue I've encountered when editing a later appointment created with recursive rule. It edits the whole block not just the single later appointment.
I can change this to create separate DB appointments but I was hoping I would not need to for DB access time.

Thanks in advance.






Karthikraja Arumugam [Syncfusion]
Replied On June 12, 2019 02:03 PM UTC

Hi Phil, 
 
Thank you for the update. 
 
Query 1: Regarding save single appointment in SQLite  
When a new appointment is added raise CollectionChanged event of your appointment collection, in the event get the appointment details and store it into the database. 
 
Code Snippet: 
 
Meetings.CollectionChanged += Meetings_CollectionChanged; 
 
private void Meetings_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) 
{ 
 
   if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) 
   { 
      var newMeeting = e.NewItems[0] as Meeting; 
      database.Query<AppointmentDB>("INSERT INTO AppointmentDB (Subject,StartTime,EndTime,AllDay,Color)values ('Yoga Therapy','" + newMeeting.From.ToString() + "', '" + newMeeting.To.ToString() + "','" + newMeeting.AllDay +"' , '" + newMeeting.Color +"')"); 
    } 
} 
 
We have modified our KB sample for the same. 
Sample link: SqliteSample 
 
Query 2: Regarding load appointment on demand basis 
You can get current view DateRange from VisibleDatesChanged event and based on visual dates load appointments from database. Kindly refer our UG documentation to know more about VisibleDatesChanged event. 
 
 
Query 3: Regarding recurrence appointment 
You can add/remove the recurrence exception appointments and recurrence exception dates to ScheduleAppointment by using its properties RecurrenceExceptionDates, RecurrenceId, ExceptionOccurenceActualDate. Kindly refer our UG documentation to know more about recurrence pattern exceptions. 
 
 
We hope this helps, kindly revert us if you have any concerns. 
 
Regards, 
Karthik Raja A 


phil
Replied On June 13, 2019 10:07 AM UTC

You are a star. 
Thank you.

Subburaj Pandian Veluchamy [Syncfusion]
Replied On June 13, 2019 10:15 AM UTC

Hi Phil, 
 
Thank you for the update. We are glad that the given solution meets your requirement.

Please get in touch with us if you would require any further assistance in future. 
 
Regards,
Subburaj Pandian V  


phil
Replied On June 17, 2019 01:50 PM UTC

Hi. Me again..
Please bear with me I'm a bit new to c#.
Running into an issue with load on demand using this approach. I've got the visible dates and select them from the Db ok.
Creating a new observable collection with just these triggers the NotifyCollectionChangedAction.Add, which then adds them to the database as duplicate records and displays  nothing in the schedule view, even though the collection binding has data.

I've also tried using the ScheduleAppointmentCollection class instead of my custom class to load the data as with your demo. This works as it should and displays basic data, but it does not pass my custom fields of cause and causes an issue when I select the appointment.

I'm running around in circles. Help..




Jagadeesan Pichaimuthu [Syncfusion]
Replied On June 18, 2019 11:39 AM UTC

Hi Phil, 
  
Thank you for the update. 
  
We have analyzed your requirement “How to restrict CollectionChanged event from adding duplicate appointment to database?”. Schedule has property called Notes which can be used to provide unique id for each appointment by using this property you can restrict the duplicate appointments from adding into database. Kindly refer our UG documentation to know more about Notes property in Schedule. 
  
  
After retrieving appointments from database update the appointment collection and DataSource of schedule to reflect appointments in view. 
  
We hope this helps. kindly revert us if you have any concern. 
  
Regards, 
Jagadeesan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon