Importing text with [User Name]
At present I have a report that imports two bodies of text, lets Say TEXT1 and TEXT2. The report works fine all text is loaded when SHOWREPORT is called.
How can i include the clients name in TEXT1, I have tried [frxDBDataset2."LAST_NAME"] in the text body. Do I have to prepare the report prior to showing, or format the text code.
How can i include the clients name in TEXT1, I have tried [frxDBDataset2."LAST_NAME"] in the text body. Do I have to prepare the report prior to showing, or format the text code.
Comments
And make sure that the memoview object receiving the texts have the ExpressionDelimiters = '[,]' (default value) and AllowExpressions = true (also default)
However, if any of the delimiters appear in the original text, you probably need to do a string replace first or change the delimiters, as anything between any '' will be treated as an expression.
I have a report that has 2 Datasets connected.
Dataset1 is a client table.
Dataset2 is an Employee table.
I have 1 data band connected to the report but not to the Datasets.
client table gives the client name in the header as [InSalon_Dataset."CLIENT_NAME_LKP"] this works fine as I only need 1 name.
Employee table gives employee name as [InSalon_Dataset."EMPLOYEE_LKP"] this works fine as I only need 1 name.
Both the above work fine.
I also have a Variable Called [HeaderText] which loads at SHOWREPORT from a text file this also works.
My problem is that I would like to import the name of the employee into the [HeaderText] file as below.
My text file as is now, shortened
Thank you for your visit and bla, bla bla
This works
but I would like to be able to output
Thank you for your visit with [InSalon_Dataset."EMPLOYEE_LKP"] and we look bla, bla, bla
employee name dosn't appear but appears as is.
The reason to import from a text file is so that text can be changed as needed
At present the Report is stored in the DFM
Thanks in advance
1. Your variable HeaderText is declared as string,
2. At runtime you read plain text (no RTF or things like that) from a file,
3. This file (and hence your variable) contains a piece of text you need to replace with other text you know at runtime.
My suggestion:
4) write your own function e.g. StringReplace( Text, T1, T2 :string) returning string
5) use this function after you have read text from the file into variable like
HeaderText := StringReplace( HeaderText, '[InSalon_Dataset."EMPLOYEE_LKP"]' , <InSalon_Dataset."EMPLOYEE_LKP">);
Pay attention that this way you can make contents of file more simple like and use replace as below:
HeaderText := StringReplace( HeaderText, '{Customer_Name}' , <InSalon_Dataset."EMPLOYEE_LKP">);
And your end user (if it is him who edits the file) will not have to use magic phrases [InSalon_Dataset."EMPLOYEE_LKP"] or so [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Mick[/img]
Both heading the same way.
Mick.pl, many thanks for the explanation, this allows the end user to build their own header text file, just what I wanted to do.
Can now move on.
Great Forum
Many thanks