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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Outputting a large string 1 row at a time 1

Status
Not open for further replies.

autumnEND

Programmer
Nov 1, 2005
61
GB
Hi, im trying to output a large string onto my report using crystal XI , each element in the strng is seperated by a comma :
i am outputting to various formats, pdf, excel, word etc

e.g string : this,is,a,long,string

i need to get it to output as :

+ this
+ is
+ a
+ long
+ string

however when it outputs the string, its displaying it as one big block of text.

is there a way to get it to output row by row as appose to one largeblock of text?

here is the formulae i use :

StringVar array Inputs;
NumberVar Counter;
StringVar Message := "<ul>";

Inputs := Split("this,is,a,large,string",");

For Counter := 1 to Count(Inputs) Step 1 Do
(
Message := Message & "<li> " + " + " + Inputs[Counter] + "</li>"
)
;
Message := Message & "</ul>";

i have set Text Interpretation to HTML text

any help would be greatly appreciated, thanks .
 
I am unsure what you want your final result to be--do you just want to build in returns to give the appearance of a list? Or do you want each element separate? For separate elements, create separate formulas like:

//{@element2}:
stringvar array x := split({table.string},",");
x[1]

//{@element2}:
stringvar array x := split({table.string},",");
numbervar j := ubound(x);
if j > 1 then
x[2]

//{@element3}:
stringvar array x := split({table.string},",");
numbervar j := ubound(x);
if j > 2 then
x[3] //etc.

-LB
 
Hi thanks for your reply

I would like to output each element seperatly, but i never know how many elements there are going to be within the string. So couldnt create the formulaes, unless there was a dynamic way to do that

when i built in returns to give the appearance of a list, it would display the field header leave a big white space and then display the data, which i thought was the result of the text being just one big block of text.

Unelss there is a way to build in returns in a better way that i did it, which im sure there is

Thanks for your help so far .
 
You will need to use LB's suggestions and create X number of formulas and hope that the number you create is greater than the number you will need. You also should create a formula that counts the number of commas in you text and checks to see if the number of strings you need to put out exceed the number of formulas you created. You could then set an alert to let you know.

Also you will need to put each formula in its own sub-section and use conditional suppression to supress the extra formualas that you don't need.

Howard Hammerman,
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
Hi,
Try this variant :
Code:
StringVar Array Nstr;
NumberVar Counter;
StringVar Message := "";
Nstr :=Split({Table.StringField}',');
For Counter := 1 to Count(Nstr) do
(
Message := Message + '+' + Nstr[Counter] + chrW(13)
);
Message

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi,
I forgot to mention that when you add that formula to your report, be sure to set the format to 'Can Grow'

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi thanks for all your help on this so far.

There could be 100s of items in the string so i need a way to dynamically do this, i cant manually create the formulae elements

Im outputting this as a sub report which is located in the page header of the main report.

using Turkbears version and my version:

if there are a list of 100 + or so items how come it starts on a new page? and doesnt start outputting the data where the sub report is located.hence causing a big block of white space

is there a way to avoid this white space issue?

 
Im outputting this as a sub report which is located in the page header of the main report"

sorry i meant the report header, and not the page header
 
Go to format subreport->common tab->uncheck "Keep object together".

-LB
 
Hi sorry for the late reply, i have been away from the computer for a few days.

in reply to lbass:
i have unchecked " keep object together " and still have the same problem.

i think its because its in a sub report and thats causing the problem

if i dont use a sub report and just output the data in the main reports report header, it displays fine.

but this is not an option, i have to use a sub report :(

as need to display the data in more than 1 report.

i am lost , and dont know what to try next.
 
Are you sure the subreport is in the page header? Anyway, go to the section expert->section sub is in->uncheck "Keep together". Also check "suppress blank section" for all displayed sections of the subreport. In design view, within the subreport, make sure you have all unused sections suppressed and that each used section is minimized in height to fit snugly around the fields displayed. If you are using Turkbears suggestion with the chrw(13), you might consider replacing that with a comma, so that the list can grow horizontally, instead of only vertically.

-LB
 
solution

in the sub report i formatted each formulae item in design view and unchecked "keep object together"

and now the report is outputting how i want

something i overlooked and forgot to set.

thanks for all your help with this issue :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top