Formatting data fields
How can I format text in a textbox according to numeric fields from database? For example: I've column of type Decimal(1,0). When the value is 0, text should be "Yes" and when the value is bigger than zero, text should be "No".
Comments
Write the following in your "Text" object:
[[myTable.myColumn] == 0 ? "Yes" : "No"]
Thanks for your answer. I did as you adviced and the result was an exception when previewing the report:
Inner exception:
Specified cast is not valid.
And more specifically:
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at S2VbCxDU0OMTvjkNaW.EFY31DBgSwIavb22nW.Y9q9Ayr4g(Object[] )
at 2EdewMbmqGQSEkKMRl.51f8d8EOnuaCgugUId.wdlCOWKl8(String , Variant )
at FastReport.Report.Calc(String expression, Variant value)
at FastReport.Report.Calc(String expression)
at FastReport.TextObject.GetData()
at FastReport.BandBase.GetData()
at FastReport.Engine.ReportEngine.ApMEyuq4E(BandBase , Boolean )
at FastReport.Engine.ReportEngine.M5Qjb8LLk(BandBase , Boolean )
at FastReport.Engine.ReportEngine.K51njN4eH(BandBase , Boolean )
at FastReport.Engine.ReportEngine.Avx9GWUhwW()
at FastReport.Engine.ReportEngine.JI19ViETCm(ReportPage )
at FastReport.Engine.ReportEngine.anE9t8f1nJ()
at FastReport.Engine.ReportEngine.dUfCsgb7K(Boolean , Boolean , ReportPage )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Show()
at PsPqgNVwHXMHeJbrIU6.eju36EVXM0ZflSjWsny.99FjXl1OC()
Any idea what's wrong?