问题
Is there a way to use the Live Binding Designer to concatenate 2 database fields to a component?
For example I have a MemTable for client, I want to concatenate the FirstName and LastName (fullname) to a label.
If there is a way to do that, I understand that the binding will be in one direction only (Database fields --> ComponentProperty).
回答1:
For something simple like this...you can use the AfterScroll Event of your Dataset
if Dataset.Active and (Dataset.RecordCount > 0) then
label1.Caption :=Dataset.FieldByName('FirstName').AsString + ' ' + Dataset.FieldByName('LastName').AsString;
回答2:
The easyest way to do with LiveBinding, is to use the CustomFormat property of the LinkFillControlToField :
Just use this format text as the example is the question: Self.Owner.FirstName.text + " " + Self.Owner.LastName.text
来源:https://stackoverflow.com/questions/28955079/how-to-concatenate-2-fields-from-a-dataset-using-livebindings