Using the LiveBindings Designer and LiveBindings Wizard in RAD Studio XE3 allows you to easily link fields to UI controls and do other common LiveBindings tasks. I wanted to bind two dataset column values (first and last name) into one TLabel in my Delphi and C++Builder demo VCL and FireMonkey applications. I asked Jim Tierney, team member here in Scotts Valley, how to do it with LiveBindings and he showed me three ways to use an expression in the CustomFormat property of the TLinkPropertyToField component. This quick video shows you how to use the LiveBindings Designer, LiveBindings Wizard and a custom expression.
In the video I use the sample InterBase XE3 Employee.gdb SQL database which includes a Customer table that has CONTACT_FIRST and CONTACT_LAST columns for the customer contact. Use one of the three following expressions in the CustomFormat property of XE3’s new TLinkPropertyToField to bind an expression to one UI control:
- A verbose version: Self.Owner.CONTACT_FIRST.Text+" "+Self.Owner.CONTACT_LAST.Text
- A less verbose version: %s+" "+Owner.CONTACT_LAST.Text
- Use this version if the field names are not valid identifiers: %s+" "+Owner.FieldByName(’CONTACT_LAST’).Text
Additonal information about the XE3 LiveBindings new TLinkPropertyToField component, the CustomFormat property, LiveBindings Designer and LiveBindings Wizard can be found at:
- LiveBindings in RAD Studio XE3 - http://docwiki.embarcadero.com/RADStudio/XE3/en/LiveBindings_in_RAD_Studio
- LiveBindings Designer - http://docwiki.embarcadero.com/RADStudio/XE3/en/LiveBindings_Designer
- LiveBindings Wizard - http://docwiki.embarcadero.com/RADStudio/XE3/en/LiveBindings_Wizard
- TLinkPropertyToField - http://docwiki.embarcadero.com/Libraries/XE3/en/Data.Bind.Components.TLinkPropertyToField
Watch on YouTube: http://www.youtube.com/watch?v=86PPmORQ7kY
Duration: 4 minutes and 23 seconds
Thank you Jim for your help showing me how to combine two dataset columns using LiveBindings.
For additional product information go to http://www.embarcadero.com/products/rad-studio