| Get text messages out of an Object as table in Word document [message #75] |
Thu, 12 April 2007 14:43  |
tverwoest Messages: 6 Registered: August 2005 |
Junior Member |
|
|
For a project I have made a knowledge base in which calculations are performed based on methods that may only be used in certain cases. To inform the user about the reason why methods are or aren't used, I have used the ADDGOALS() function to add the creation of a message when the specific calculation is initiated.
For example (see also attached QKB):
a = ADDGOALS(b,c)
b is the calculation (for instance b = input
);
c$ is the additional goal, for instance the generation of a message (c$="Example text "+STR$(b));
both the relation "a" and the relation for c$ could have constraints that make sure the proper calculation and message is carried out (not used in example...).
When you do this for multi cases in an object, in Quaestor you will get a table (TeLiTab) with message c$ for each case.
D(@a,@input:From$ + "(" + Step$ + ")" + To$)
D is a function that creates "a" (indicated by @a) on the basis of "input";
From$ is the lower bound of the input;
Step$ is the step size;
To$ is the upper bound;
By the way, From$ + "(" + Step$ + ")" + To$ is a nice trick to create a range as input for an object.
Please note that normally you only can provide a range for parameters after you have created a model (the process of request for choices and input). In this way you are actually able to create the range for the object.
When you want to present the messages as list in a Word document, you start with the generation of a table in Quaestor using the template function:
e$ = TEMPLATE$(TEXTITEM$(1), 1, @D)
TEXTITEM$(1) it the actual template (see hereafter);
@D is the object to go into the template;
The template description in the data slot of the relation:
TEXTITEM1=
"~D(c$)"
After you have done this, you would expect a list with the messages. However you will be confronted with several issues:
- When you use the TEMPLATE() function, items are aligned to the right by default;
- The amount of content of c$ to be presented in the list is limited by the Cell width defined in Slots & Properties of parameter c$;
The solution to overrule this issue is to user format statements (See the FORMAT$() function of Quaestor).
So write the template part as:
TEXTITEM1=
"~D(c$|A100)"
Now the values are aligned to the left and have a width of 200 characters. Please note that the limit for Cell width in the Slots & Properties is 255.
However, you will discover at this point that the values for c$ are now placed without carriage return.
The reason is that you should explicitly indicate that you do want this to happen by adding /| to the format statement(you do not always want this to happen).
So change the template to (relation f$ in the example):
TEXTITEM1=
"~D(c$|A100/|)"
Please note that I did not include the following part in the example knowledge base.
To get this list into your Word document, you can simply add:
#f$# into your RTF template Remember to recheck the RTF document using Tools>RTF Template Check...). See the WINWORD$() function.
When you generate the report, you discover the last issues:
- The normal linefeed used in the ASCII generated by f$ is not recognized as code in RTF. The generation of a Word report is based on RTF and after generating saved as *.DOC and the brakes between items in the list are lost;
This can be solved by adding the RTF paragraph break for Word by yourself. Do this in the text of c$.
The correct RTF code is \par.
So rewrite the relation c$ as:
c$="\par" + Text$
Text$ is the text of each message;
"\par" is the paragraph break as RTF code;
By placing \par prior to Text$ you can avoid having problems with possible additional spaces that might be part of the end of the string, depending on the cell width defined as A200 (when your string is only 10 characters long, 190 spaces are included at the end of the string).
[Updated on: Thu, 02 August 2007 09:08] by Moderator
|
|
|
| Re: Get text messages out of an Object as table in Word document [message #85 is a reply to message #75 ] |
Thu, 02 August 2007 09:13  |
Qnowledge Messages: 57 Registered: August 2005 Location: Netherlands |
Member |
|
|
Relevant information for this issue can also be found here:
[Updated on: Thu, 02 August 2007 09:20]
|
|
|