Conditionally including DB fields in Rich Text Components
I am using Report Builder (Professional) v10.09 with Delphi 2007.
With Mail Merge, it is possible to include database fields in Rich Text
components.
Is it possible to conditionally include database fields in Rich Text
components?
For example,
* if Invoice.Status = "Paid" then Comments.ThankYou
* if Invoice.Status = "Not Paid" then Comments.Reminder
What do I need to do to achieve this? I suspect this is easy using the
Enterprise version with RAP.
Richard Harding
With Mail Merge, it is possible to include database fields in Rich Text
components.
Is it possible to conditionally include database fields in Rich Text
components?
For example,
* if Invoice.Status = "Paid" then Comments.ThankYou
* if Invoice.Status = "Not Paid" then Comments.Reminder
What do I need to do to achieve this? I suspect this is easy using the
Enterprise version with RAP.
Richard Harding
This discussion has been closed.
Comments
In this case, you would need to alter the actual RichText source before it
is processed by the engine with the updated field information. You can do
so using the various RichText routines given such as the Paragraph,
SelAttributes, SelStart, SelLength, and SelText properties. See the help
topic for the TppCustomRichText object for information on these.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
With a calculated field, I think would need to know the condition in
advance.
The comment table frequently contains several hundred user defined
comments. A comment needs to be inserted into the Rich Text component
based any number of conditions which are not known at design time.
A medical example is:
* if PSA result is less than 0.8
* then insert a comment indicating a low PSA result
An example from the building industry:
* if the roof pitch is less 12 degrees
* then insert a comment regarding the pitch of the roof.
I was hoping that RAP may enable me to create and process tags similar
to the way Mail Merge processes the tags.
For example,
LowPSA
LowPitch
A solution that would possibly work is in the BeforePrint event
* search for the tags in the Rich Text
* pass the condition as a parameter to a stored procedure
* stored procedure performs the required lookup.
Richard Harding
You could also leverage the MailMerge feature and perform the conditions in
RAP...
if then
RichText.SelText := 'MyField'
else
RichText.SelText := 'MyOtherField';
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
trying to do.
Richard Harding