Best practice: Binding FNC components to dataset/list

I am struggling binding data to the components in a bidirectional way.
There are some readonly binders available and some components support live bindings.

Is there any recommended best practice to bind the FNC components to data? What generic way could I go?

Thanks for your answers and ideas!

Hi, right now the only bidirectional databinding components available are

  • TTMSFNCGridDataAdapter
  • TTMSFNCPlannerDataAdapter

Additionally, there is a generic TTMSFNCDataBinder that is capable of reading data. The plans are to expand on this in the future for writing as well.

Digging out this topic.

Is there any recommended best practice to bind the FNC components to data?

I want to use FNC componets only and I use Aurelius , too.

I know, that I can bind the grid to the data, but I am unsure how to proceed with simple componets.

Hi,

For some components there are adapters (TMS FNC UI Pack), which bidirectionally bind (read / write)

  • TTMSFNCDataGridDatabaseAdapter
  • TTMSFNCPlannerDatabaseAdapter
  • TTMSFNCKanbanBoardDatabaseAdapter
  • TTMSFNCTimeLineDatabaseAdapter

For all the other components, you need to use the TTMSFNCDataBinder component, but this is ReadOnly. (TTMSFNCDataBinder - TMS FNC Core)

Any updated plans to make the TTMSFNCDataBinder Read/Write?

We'll need to discuss the next steps here, but the goal is to make it write as well yes.

Same for me, I would prefer only use FNC components. Beside your new data grid, I have to rely on other components to connect to a dataset. Hope this is on your top priority.

We've added this on our list of things to do and determine priorities next week.

Good to hear. This indeed would be great!

Any updates on the schedule?

Currently being worked on write support.

The latest TMS FNC Core (4.1.1.8) already contains some improvements to experiment with.
So if you want to write to a DB, you can call

TMSFNCDataBinder1.Items[0].NotifyEdit;
TMSFNCDataBinder1.Items[0].NotifyValueChanged;
TMSFNCDataBinder1.Items[0].NotifyPost;

This should post the changed value of your binded item to the dataset you are connected to.

Retrieving a binded item based on the control can be done with

TMSFNCDataBinder1.ItemByObject[];

What do these methods different than this approach?

var
  DB: ttmsfncdatabinderitem;
begin
  DB := FTMSFNCDataBinder.ItemByName[sComponentName];
  DB.DataSetEdit;
  DB.WriteValueToField;
  DB.DataSetPost;
end;

They are the same, but flag all items, meaning all fields will be updated regardless of the value. We are experimenting with an automated way of posting the value, but so far we haven't been able to find a reliable way, therefore we decided to integrate this into FNC CustomControl, which will be able to call these methods. For FNC specific controls we will be caling this automatically, but for non FNC controls, this will need to be called manually.

I see. Thank you for the answer.

I am playing a bit with this approach, encapsulated in a class:

  • registering a control with datasource and fieldname
  • binding to to the databinder
  • Hooking onEnter/onExit
  • onEnter saves the old value
  • onExit compares the new value and optionally issues the write
1 Like

Hi, I'm wondering if you could provide some feedback on the way the binding happens now, is everything working fine? Do you require additional binding options, for writing? We plan to start integrating this in existing FNC components (where it makes sense)

Binding for reading works fine. I bind by code and and played a bit with using the name of the control as as binding schema. As posted above the WriteValueToField works fine, too. What I am missing is kind of automatic writing/posting, as was there when using datasensitive db-controls in VCL.

The (simple) Tmemo is the only component I am missing from FNC. Edit, Combo, Checkbox, Radiogroup and date/time edit are prio one, where I would like to have read/write binding.

Additional binding options may include conversion (e.g. fieldvalue is integer, but control is date, or field value is Y/N but control is checkbox) and validation.

Thanks!