Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I print more than 1 record on the same line in details area?

Status
Not open for further replies.

MannyTC

IS-IT--Management
Nov 3, 2003
5
US
I am trying to write a report that will show multiple records on the same line. The database I am trying to write this report for stores separate sentences of a paragraph in separate records. The application can print out reports and put the paragraphs back together with flags from other fields that tell it whether or not the sentences were part of a paragraph and should be kept together. I have a need to create a slightly customized version of the apps built in report (its not crystal) and need to at bare minimum get the sentences to print together as opposed to having each sentence print out on a separate detail line.

I hope this makes sense.

Any help would be appreciated.
 
What version of CR are you using? You'll probably run into the 254-character limit if you have CR 8.5 or less. I'm unclear how the flags are set up. Is there a way you could use them to create groups of sentences that belong in a paragraph? Then you could use the three-formula approach that follows, assuming that you have CR 9.0:

{@reset} to be placed in group header:
whileprintingrecords;
stringvar paragraph := "";

{@sentences} to be placed in the details section:
whileprintingrecords;
stringvar paragraph := paragraph + {table.sentence};

{@paragraph} to be placed in the group footer:
whileprintingrecords;
stringvar paragraph;

Then suppress the header and details section to display the paragraph in one line. You might want to size {@paragraph} and then (field) format it to "can grow".

If you can't use the flags for grouping, please explain how they work.

-LB
 
Unfortunately I am forced to use 8.5 for compatibility purposes with the app I am using. Is there any other way you can think of doing this?

The flag is in the same table and if the sentence is supposed to be part of a paragraph it will contain the word "text" will appear in one of the fields and if not it will be null I believe. So if the word "text" does not appear that record should be on a line by itself and if it does it should be part of a paragraph.
 
How big do these paragraphs get? I assume each sentence is under 254 chars...YES??

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Some of them get kinda big. The field which contains the sentences is varchar 255. One sample I am looking at now has 19 sentences.
 
hmmm...Crystal cannot grow horizontaly so you are kinda hooped as far as linking the individual fields together but we might try doing it in bits and pieces. I am thinking about chopping up each field into smaller fields...

the basic idea is this (thinking out loud here)

1. Without a "Can Grow" you could not display a complete field anyway...right
2. Depending on your font you might be able to display say 80 chars from margin to margin
3. we would store each field value and flag in an array element for later processing in a footer.
4. then we would print out the paragraph in 80 char segments, terminating the segment when we encountered a NewParagraph flag.
5. currently you have an example of 19 sentences of 254 char each...this means we must at the least have (254/80)*19 = about 80 subsections in the footer printing the result.

So we should plan for 100 subsections...obviously this is a lot and could be reduced if you had a smaller font giving you more chars/line....

We would have no indentation to the paragraph and a single blank line will separate the paragraphs

So...in the report header place the following forumla

//@initialize (suppressed)

WhilePrintingRecords;
//for sake of arguement we shall make it 30 sentences + 20
//indications of a new paragraph (this will make sense
//later) for a total of 50 elements.
stringVar Array Info := [ "","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","" ];
//the final 100 subsection values
stringVar Array Final := [ "","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","" ];
numberVar pointer := 0;


in the detail section

//@CollectSentences/flags (suppressed)

WhilePrintingRecords;
stringVar Array Info;
numberVar pointer;

pointer := pointer + 1;
Info[pointer] := trim({table.sentence});
if {Table.flag} <> &quot;Text&quot; then
(
pointer := Pointer + 1;
Info[pointer] := &quot;NP&quot;;
);

okay now we have to combine this in a footer somehow

Okay the final result will be in the report footer

in the Group footer though place the following formula

//@CombineSentences

WhilePrintingRecords;
stringVar Array Info;
stringVar Array Final;
stringVar temp;
numberVar pointer;
numberVar y;
numverVar x;
numberVar subsection := 1;

for temp := 1 to pointer do
(
temp := info[y];
for x := 1 to length(y) do
(
if length(Final[subsection]) < 80 then
(
if temp[x] + temp[x+1] <> &quot;NP then
Final[subsection] := Final[subsection] + temp[x]
else
(
subsection := subsection + 1;
Final[subsection] := &quot; &quot;; //NP blank line
subsection := subsection + 1;
Final[subsection] := &quot;&quot;; //to make if-then work
);
)
else
(
subsection := subsection + 1;
if temp[x] + temp[x+1] <> &quot;NP then
Final[subsection] := Final[subsection] + temp[x]
else
(
Final[subsection] := &quot; &quot;; //NP blank line
subsection := subsection + 1;
Final[subsection] := &quot;&quot;; //to make if-then work
);
);
);
);

Now in each of 100 report footer sections you would place a formula like the following...stretched...margin to margin

//@DisplayLine1 (placed in report footer section A)

WhilePrintingRecords;
stringVar Array Final;

Final[1];

*******************
//@DisplayLine2 (placed in report footer section B)

WhilePrintingRecords;
stringVar Array Final;

Final[2];

you get the picture....make sure you have the &quot;suppress Blank section&quot; enabled for each report footer subsection.

That might do the job for you ....hope it gives you some ideas anyway....


Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Thanks for the suggestion! I am working through it now. I'm getting errors on some of the syntax and will let you know how it works out when I figure out whats wrong with it. I just copied and pasted from your post here and made changes to the field names as needed so there must be some typos in there somewhere.
 
can't help there til you show me :)

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Ok I think I figured out what was wrong. Below is what you had in your original post and I show what I think it should be on 2 of the lines. Let me know if I am right.

//@CombineSentences

WhilePrintingRecords;
stringVar Array Info;
stringVar Array Final;
stringVar temp;
numberVar pointer;
numberVar y;
numverVar x;
numberVar subsection := 1;

for temp := 1 to pointer do (I THINK THIS SHOULD BE Y INSTEAD OF TEMP)

(
temp := info[y];
for x := 1 to length(y) do SHOULD BE LENGTH(info[y])?


It seems to work so far (I haven't put in all of the footer sections yet). Only problems I have is the new paragraph part doesn't seem to be working right, the blank areas are still printing even though I set section to supress blank section and the people needing this report are not happy with the sentences breaking mid-words. I suppose we can do another sweep and have it only break on a space somehow.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top