Search code examples
delphidelphi-xe4livebindings

Is it possible to use stacked expressions / to specify more than one parameter for `CustomFormat` in Delphi LiveBindings?


I want to specify

LinkControlToDate.CustomFormat := 'IfThen(%s=0, '''', FormatDateTime(''ddddd'', %s))'

for the property CustomFormat of a TLinkControlToField to handle 0 date values.

But this yields a EConvertError

'no argument for format 'IfThen(%s=0, '', FormatDateTime''

Is it not possible to use a function inside a function with CustomFormat?


Solution

  • You use the parameter %s twice, but there is only one parameter.

    Try

    LinkControlToDate.CustomFormat := 'IfThen(%s=0, '''', FormatDateTime(''ddddd'', %:0s))'
    

    Use an index specifier for the second %s.