1
votes

I am using FastRepors v4.11 which comes with Delphi XE2

Is there a way I can set the text for a MemoView dynamically using nested expressions

I tried a couple of different ways but none seem to work

[ReportHeader."Ch[ReportHeader."Channel"]Label"]

[ReportHeader."Ch<ReportHeader."Channel">Label"]

<ReportHeader."Ch[ReportHeader."Channel"]Label">

[ReportHeader."Ch" + [ReportHeader."Channel"] + "Label"]

Channel holds a value like 1 or 2 or 3 or 4. I want the MemoView to display the evaluated value of CH1Label or CH2Label etc

So if ReportHeader.Channel = 4 then the value of [ReportHeader."Ch4Label"] should be rendered inside the MemoView

**Setting the text for MemoView dynamically in my Delphi code, before the report is printed works but I am wanting to simplify the code by moving this logic to FastReports

1

1 Answers

1
votes

Fast Report's expression parser does not support nested expressions in the way you are trying to use them. As you only have the bundled Embarcadero version of Fast Reports, your only solution is to modify the memo view directly in your Delphi code or create a calculated field for the memoview component.

The paid for version of Fast Reports (Standard and up) support event handlers and scripting at the report component level, so if you wanted to keep the display logic in your report, then you could use scripting and use the OnBeforePrint event of the MemoView in question within the Fast Reports designer.