Embedding expressions in text
I am using FR 4.3, Delphi 7. In my app there are various letters that are printed, and the user wants to be able to change the text of those letters rather than having it hard-coded. The text is stored in a table called Letters, in the field LetterText, and contains some embedded field names. This is a typical entry:
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->Thank you for your order for shoes for <B>[frxDBInvoice."Patient"]</B>. This order will be shipped on approximately <B>[frxDBInvoice."ExpectedShipDate"]</B>. The price will be approximately <B>[frxDBInvoice."Balance" #n%2.2m]</B>.
<!--fontc--></span><!--/fontc-->
In my report I included this field, [frxDBInvoice."LetterText"], in one of the bands and expected it to substitute the field values within the text when it runs so it would look like this:
Thank you for your order for shoes for John Smith. This order will be shipped on approximately 08/11/2010. The price will be approximately $250.00.
Instead, it is printing the text exactly as it is in the database, with the field names instead of the values (it does interpret the HTML code <B> correctly as bold). I have AllowExpressions set to true, and ExpressionDelimiters set to the default [,] so I don't know why it doesn't work. Is there some issue with interpreting expressions within a field pulled from a database?
Glenn
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->Thank you for your order for shoes for <B>[frxDBInvoice."Patient"]</B>. This order will be shipped on approximately <B>[frxDBInvoice."ExpectedShipDate"]</B>. The price will be approximately <B>[frxDBInvoice."Balance" #n%2.2m]</B>.
<!--fontc--></span><!--/fontc-->
In my report I included this field, [frxDBInvoice."LetterText"], in one of the bands and expected it to substitute the field values within the text when it runs so it would look like this:
Thank you for your order for shoes for John Smith. This order will be shipped on approximately 08/11/2010. The price will be approximately $250.00.
Instead, it is printing the text exactly as it is in the database, with the field names instead of the values (it does interpret the HTML code <B> correctly as bold). I have AllowExpressions set to true, and ExpressionDelimiters set to the default [,] so I don't know why it doesn't work. Is there some issue with interpreting expressions within a field pulled from a database?
Glenn
Comments
it creates one long string when it is processed.Ie it is the expression being processed
try this in the obp event of the band put the value of the datafield in the memos text
then when the memo is processed the internal expression will be evaluated.
memo1.memo.text := <frxDBinvoice."LetterText">;
BTW you are way out of date current version is 4.9.106, you should periodically check your customer dl page and see what updates are available to you.
this expression is processed and the text of that field is substituted for the expression.
thats it done on to the next object to be processed.
when you retreive the text of the field in the obpevent of the band and insert it into the memo,
the memo then contains all the text with it's embedded expression before the engine handles the memo view, now when it handles the memoview the embedded expression is handled.
the engine processess bands from top down according to type and objects in the band from left to right in order of creation.