Blog

All Blog Posts  |  Next Post  |  Previous Post

Seamless Data Binding with the TMS FNC Timeline Database Adapter

Tuesday, September 17, 2024

When building modern applications that need to visualize time-based data, the challenge often lies in efficiently linking your UI components with your database. In the latest update of TMS FNC UI Pack, we've added the TMS FNC Timeline Database Adapter. With this component, you can easily populate your timelines with data from your preferred database. This powerful feature streamlines data binding, automatically reflecting changes in real-time, and simplifying the process of managing large datasets in timeline visualizations. In this blog post, we will explore the TMS FNC Timeline Database Adapter, its features, and how to leverage it for database-driven applications.

TMS Software Delphi  Components

TMS FNC Timeline Database Adapter

The TMS FNC Timeline Database Adapter is a specialized component that bridges the gap between your database and the TMS FNC Timeline. This adapter allows you to bind the timeline directly to a dataset, making it possible to visualize database records as events on the timeline without writing custom code for data extraction and mapping. 

Why Use the TMS FNC Timeline Database Adapter?

  • Automatic Data Population: No need for manual mapping—just connect your dataset, set the respective fields and the timeline is populated with events from your database.
  • Writeable: Changes in your timeline will be stored in the database, ensuring your users always see the most up-to-date information.
  • Cross-Platform: The adapter works across multiple frameworks and platforms, including VCL, FMX, and TMS WEB Core, making it suitable for desktop, mobile, and web applications.

Key Features

Effortless Data Binding

The TMS FNC Timeline Database Adapter simplifies the task of binding database fields to timeline events. With a few property settings, you can connect database fields like start time/value, end time/value, and event title to the corresponding properties of the timeline's event objects.

For example, in a project management application, you can link a database table containing project milestones and deadlines to the timeline, allowing users to see the progression of tasks without manually inputting the data.

Customizable Field Mappings

The adapter allows you to map different fields in your database to various properties of timeline events, such as:

TMS Software Delphi  Components

Next to the Start Time and End Time, you have the option to use the Start Value and End Value. This helps you to use numeric values instead of datetime types.

It is also possible to define wether the Indicators or Sections are Selectable and Fixed in place.

The difference between Indicators and Sections is based on the end time/value, if that field is not defined then an Indicator will be automatically used. If there is an end time/value field assigned, then there will be check if the start time/value differs from the end time/value. If that is the case then a Section will be added.

You can configure this mapping either at design time through the object inspector or programmatically at runtime.

Customization

You can further customize how the data is displayed by handling the various events that the timeline provides, such as manipulating the datetime formatting, or use other fields to have additional information e.g. a background color for the indicator/section.

Example

If you read the previous post on the TMS FNC Timeline, you might have already noticed the timetable demo.
To show you how easy it is to implement, we've changed the demo to use the database adapter.
First of all we need to assign the Fields that correspond with the item properties.

  TMSFNCTimelineDatabaseAdapter.Item.DataSource := DataSource1;
  TMSFNCTimelineDatabaseAdapter.Item.DBKey := 'Id';
  TMSFNCTimelineDatabaseAdapter.Item.StartDate := 'Start';
  TMSFNCTimelineDatabaseAdapter.Item.EndDate := 'End';
  TMSFNCTimelineDatabaseAdapter.Item.Text := 'Title';

  TMSFNCTimelineDatabaseAdapter.Active := True;
When the database adapter is active, it will automatically fill the timeline with the sections.
But we need to add some additional information as to know in which room the session is hosted.
For this we can use the OnFieldsToSectionEvent.
procedure TTimeTableForm.TMSFNCTimelineDatabaseAdapterFieldsToSection(Sender: TObject; AFields: TFields; ASection: TTMSFNCTimelineSection;
  var ADefaultSet: TTMSFNCTimelineDatabaseAdapterSectionFieldsParams);
begin
  ASection.Fixed := True;
  ASection.Row := AFields.FieldByName('Room').AsInteger - 1;
end;
And that is all that you'll need to do, to go from predefined sections to use database items.

Practical Use Cases

The TMS FNC Timeline Database Adapter is ideal for applications that require dynamic and data-driven timelines. Here are a few common use cases:

  • Project Management Tools: Visualize project tasks, milestones, and deadlines directly from a project management database. Users can see task progress in real-time as the database is updated, allowing for better project tracking and scheduling. It can be used as a less detailed overview on your dashboard for the TMS FNC Gantt Chart.

  • Historical Data Visualization: For applications that track historical events or trends, the database adapter can be used to pull large datasets from a database and present them in a clear, interactive timeline. This is useful in research applications, educational tools, or business intelligence dashboards.

TMS Software Delphi  Components

    Conclusion

    The TMS FNC Timeline Database Adapter takes the hassle out of integrating time-based data from a database with your timeline visualizations. By automating the process of data binding and handling real-time updates, it provides a powerful and flexible solution for developers. Whether you’re building a project management tool, scheduling application, or data visualization dashboard, this adapter ensures that your timelines are always synced with your data, making it easier to manage and present dynamic information.

    Ready to explore the TMS FNC Timeline Database Adapter? Check it in our TMS FNC UI Pack, and start transforming your time-based data into rich visual timelines today!



    Gjalt Vanhouwaert




    This blog post has not received any comments yet.



    Add a new comment

    You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
    All fields are required.



    All Blog Posts  |  Next Post  |  Previous Post