Page 1 of 1

Using expressions (if..the..else etc.) in a TRichViewEdit?

Posted: Tue Nov 09, 2021 4:35 pm
by Alexander_Dober
Hello,

long time ago I've been asking here on the forum about the possibility to use "conditions" (if..the..else etc.) in a TRichViewEdit and it wasn't possible back then.

Today I saw this announcement http://www.trichview.com/forums/viewtop ... f=6&t=9954 and am wondering, if it's possible to use those expressions in a TRichViewEdit as well or if it could be considered for a future release, now that the functionality exists in general?

Re: Using expressions (if..the..else etc.) in a TRichViewEdit?

Posted: Wed Nov 10, 2021 7:55 am
by Sergey Tkachenko
Expressions are included in ReportWorkshop add-on.
No, I do not plan to include them in core TRichView.
Actually, I do not understand what they should do there. Expressions can be used to build a report from a report template, and this is a task of ReportWorkshop.

Re: Using expressions (if..the..else etc.) in a TRichViewEdit?

Posted: Wed Nov 10, 2021 9:49 am
by Alexander_Dober
We use TRichViews in ReportBuilder templates. The content is determined by the user via TRichViewEdits. Here we often use the placeholder functionality (don't remember how you call it officially), i.a. the user can place variables / placeholders like {Customer: Address} etc. in an TRichViewEdit, which are bound to the appropriate codes / field names like CUSTOMER_ADDRESS in the background. Before displaying the contents in ReportBuilder, we replace the placeholders with the actual values, which differ depending on the customer and other conditions.

For instance when designing a text template for a payment method in an invoice, the text can differ depending on whether the customer gets a tax free invoice or not, without expressions one has always to do some manual adjustements to the text template, i.e. remove the or add the tax free part or select a second text template. With expressions one could use just one text template like {if TAX_FREE = true then <tax free text> else <normal text>} or so.

Or if we would allow the end user to design templates to format addresses. Depending on the country the layout, the order etc. are different. Some countries have street names, some don't. Expression would help here too.

I think at least in combination with those placeholders there are quite some use cases for expressions.

Re: Using expressions (if..the..else etc.) in a TRichViewEdit?

Posted: Wed Nov 10, 2021 9:54 am
by Sergey Tkachenko
This is a functionality of ReportWorkshop. It process fields like {Customer} or {$IF}, and more complex expressions.
I am thinking about adding ReportWorkshop add-on to ReportBuilder reports, they should work together nicely, to solve the task you described.
Unfortunately, there are higher priorities now.