How do I bind a TTMSFMXTableView control?

Hello,


I am still relatively new to Delphi FireMonkey and cannot seem to figure out how to data bind the TTMSFMXTableView control. The demo projects show complete samples but not how to get from point A (a blank form) to point B (a bound table view). The documentation seems to be out of date as well. When I tried to follow that procedure I do not see the same options in Delphi 10.1 Berlin so perhaps things have changed slightly.

I will outline what I have done so far and hopefully one of you can help me along the way?

First I created a new FireMonkey project with a data module containing a database connection and a table. These are DevArt's UniDAC components but I do not believe that should affect the outcome.



On the main form I've place a table view control and a standard grid. The grid is data bound to verify that the connection and table both open properly.



When I go to the table view's LiveBindings property I see "Bind Visually..." instead of "New Live Binding..." as shown in the developer's guide.



If I click this and attempt to bind them visually the IDE refuses to do so.



If I right-click on the bindings list I can choose "New LiveBinding..."



Just a wild guess on my part but I chose TTMSFMXBindDBTableViewLink.



As another wild guess I set the "SourceComponent" property to BindSourceDB1 and the ControlComponent to TMSFMXTableView1.

When I click the ellipsis button of the ColumnExpressions property a collection editor floats over the IDE and I can add expressions.



Again, I guessed and picked the ProductName column for the SourceMemberName. However, I have no idea what to put for the ControlMember name. Or if I'm completely barking up the wrong tree to begin with.

When I run the project I get blank lines in the table view control.

What am I missing / doing wrong?

Thank you!

Hi, 


You got everything correct, except you need to bind columns to item properties via the TTMSFMXBindDBTableViewLink component. When double-clicking on the link inside the BindingsList you will notice this window below, but without the column expressions.




Call me dense but I'm still not getting it. When I double-click the link the the BindingsList I can add columns but can't seem to figure out how to bind them to item properties.

This is what I see, and everything is disabled.


Hi, 


You need add a control expression inside the CellFormat property

Control expression for TMSFMXTableView1:
  Caption

Source expression for BindScopeDB1, ProductExpression:
  AsString

Oh, I see. I thought "FormatCellExpression" would be for things like formatting numerics, justification, etc.

I've added the Caption -> Name column to show the product name.

I've added a second column that I was hoping to bind to the Description property of the items.



And the expression:



When I run the program I get this error:




Nevermind. I'm an idiot... I needed to use AsString for the source expression.

The Source expression should return AsString instead of Description