<?xml version="1.0" encoding="ASCII"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Apending Strings in v8.5 into one long string over 256 Chars</title>
	<atom:link href="http://kenhamady.com/cru/archives/130/feed" rel="self" type="application/rss+xml" />
	<link>http://kenhamady.com/cru/archives/130</link>
	<description>Independent news, tips and thoughts from a Crystal Reports expert</description>
	<pubDate>Fri, 21 Nov 2008 21:54:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: OWright</title>
		<link>http://kenhamady.com/cru/archives/130#comment-48</link>
		<dc:creator>OWright</dc:creator>
		<pubDate>Thu, 14 Aug 2008 18:20:16 +0000</pubDate>
		<guid isPermaLink="false">http://kenhamady.com/cru/archives/130#comment-48</guid>
		<description>Hello,

I liked the idea but I think what I had come up with as far as dealing with the 8.5 limitation was better suited for my needs. Being that you folk had given me the idea I will post my version of the code. Please let me know what you think.

Here is my script that I place at the report header:
--------------------------------------------------
Shared StringVar Array strings;
Shared NumberVar arrayMax := 1;
Shared NumberVar maxLength := 250;
Shared BooleanVar firstTime := true;

Redim strings[arrayMax];

strings[1] := "";

'done!'
--------------------------------------------------

Here is my main loop that I used in the group header:
--------------------------------------------------
WhilePrintingRecords;
Shared StringVar Array strings;
Shared NumberVar arrayMax;
Shared NumberVar maxLength;
Shared BooleanVar firstTime;

Local StringVar enteredString;
Local NumberVar lenStr;
Local NumberVar lenArr;
Local NumberVar lenLeft;

enteredString := [Field Name];

enteredString := IIF(firstTime,enteredString, ", " &#38; enteredString);

firstTime := false;
lenStr  := Length(enteredString);
lenArr  := Length(strings[arrayMax]);
lenLeft := maxLength - lenArr;

if (lenLeft &#62;= lenStr) then
(
    strings[arrayMax] := strings[arrayMax] &#38; enteredString;
    ''
)
else
(
    strings[arrayMax] := strings[arrayMax] &#38; left(enteredString, lenLeft);
    arrayMax := arrayMax + 1;
    redim preserve strings[arrayMax];
    strings[arrayMax] := "";
    strings[arrayMax] := strings[arrayMax] &#38; right(enteredString, lenStr - lenLeft);
    ''
)
--------------------------------------------------

and then to display the different sets in the text area. I would have one of these for every element I need displayed and change the display number variable.
--------------------------------------------------
Shared StringVar Array strings;
Shared NumberVar arrayMax;

Local NumberVar displayNumber := [element in array];

if(arrayMax &#62;= displayNumber) then
(
    strings[displayNumber];
)
else
(
    '';
)
--------------------------------------------------
I like this version better because the array is completely dynamic. It can be as big or as small as it needs to be. Please let me know what you think.</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I liked the idea but I think what I had come up with as far as dealing with the 8.5 limitation was better suited for my needs. Being that you folk had given me the idea I will post my version of the code. Please let me know what you think.</p>
<p>Here is my script that I place at the report header:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Shared StringVar Array strings;<br />
Shared NumberVar arrayMax := 1;<br />
Shared NumberVar maxLength := 250;<br />
Shared BooleanVar firstTime := true;</p>
<p>Redim strings[arrayMax];</p>
<p>strings[1] := &#8220;&#8221;;</p>
<p>&#8216;done!&#8217;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Here is my main loop that I used in the group header:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
WhilePrintingRecords;<br />
Shared StringVar Array strings;<br />
Shared NumberVar arrayMax;<br />
Shared NumberVar maxLength;<br />
Shared BooleanVar firstTime;</p>
<p>Local StringVar enteredString;<br />
Local NumberVar lenStr;<br />
Local NumberVar lenArr;<br />
Local NumberVar lenLeft;</p>
<p>enteredString := [Field Name];</p>
<p>enteredString := IIF(firstTime,enteredString, &#8220;, &#8221; &amp; enteredString);</p>
<p>firstTime := false;<br />
lenStr  := Length(enteredString);<br />
lenArr  := Length(strings[arrayMax]);<br />
lenLeft := maxLength - lenArr;</p>
<p>if (lenLeft &gt;= lenStr) then<br />
(<br />
    strings[arrayMax] := strings[arrayMax] &amp; enteredString;<br />
    &#8221;<br />
)<br />
else<br />
(<br />
    strings[arrayMax] := strings[arrayMax] &amp; left(enteredString, lenLeft);<br />
    arrayMax := arrayMax + 1;<br />
    redim preserve strings[arrayMax];<br />
    strings[arrayMax] := &#8220;&#8221;;<br />
    strings[arrayMax] := strings[arrayMax] &amp; right(enteredString, lenStr - lenLeft);<br />
    &#8221;<br />
)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>and then to display the different sets in the text area. I would have one of these for every element I need displayed and change the display number variable.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Shared StringVar Array strings;<br />
Shared NumberVar arrayMax;</p>
<p>Local NumberVar displayNumber := [element in array];</p>
<p>if(arrayMax &gt;= displayNumber) then<br />
(<br />
    strings[displayNumber];<br />
)<br />
else<br />
(<br />
    &#8221;;<br />
)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
I like this version better because the array is completely dynamic. It can be as big or as small as it needs to be. Please let me know what you think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken Hamady</title>
		<link>http://kenhamady.com/cru/archives/130#comment-43</link>
		<dc:creator>Ken Hamady</dc:creator>
		<pubDate>Tue, 04 Mar 2008 11:25:36 +0000</pubDate>
		<guid isPermaLink="false">http://kenhamady.com/cru/archives/130#comment-43</guid>
		<description>Dan, 

Thanks for the contribution.  If you follow the link to my original formula you will see that the main formula is designed to work with a 'reset' formula, which is why there appears to be a dead variable.  The 'reset' formula prevents the initial comma and also allows a separate accumulation for each group. This is described in the original formula page but probably not very clear here.

So I tested my version of this formula with a grouped report and found that the 'reset' formula needs to be changed for this expanded formula.  It should also reset the variable 'SetCnt' back to the number 1 at the beginning of each group. 

Your version does work better if there is no need to have a group reset.</description>
		<content:encoded><![CDATA[<p>Dan, </p>
<p>Thanks for the contribution.  If you follow the link to my original formula you will see that the main formula is designed to work with a &#8216;reset&#8217; formula, which is why there appears to be a dead variable.  The &#8216;reset&#8217; formula prevents the initial comma and also allows a separate accumulation for each group. This is described in the original formula page but probably not very clear here.</p>
<p>So I tested my version of this formula with a grouped report and found that the &#8216;reset&#8217; formula needs to be changed for this expanded formula.  It should also reset the variable &#8216;SetCnt&#8217; back to the number 1 at the beginning of each group. </p>
<p>Your version does work better if there is no need to have a group reset.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan_Burleson</title>
		<link>http://kenhamady.com/cru/archives/130#comment-42</link>
		<dc:creator>Dan_Burleson</dc:creator>
		<pubDate>Tue, 04 Mar 2008 05:15:24 +0000</pubDate>
		<guid isPermaLink="false">http://kenhamady.com/cru/archives/130#comment-42</guid>
		<description>Ken,

Thanks very much for all that you do in putting this Crystal information out there.

In this blog entry the code from Shelly generally works, but includes dead code and dead variables.  Note that the variable ChCnt is only set to the value of 2 (other than 0 initially), but is tested for a value of 1.

Below I have eliminated the dead code and variable plus I added a simple test that eliminates the comma from the beginning of the resulting composite string.

&lt;code&gt;WhilePrintingRecords;
StringVar Item:= {your.stringfield};
StringVar Chain;
NumberVar ChCnt;
NumberVar SetCnt;
StringVar Set1;
StringVar Set2;
StringVar Set3;
StringVar Set4;
StringVar Set5;&lt;/code&gt;

&lt;code&gt;if Length(Chain) + Length(Item) &#62; 200
            then (SetCnt := SetCnt + 1;
                    if SetCnt =1 then Set1 := Chain;
                    if SetCnt =2 then Set2 := Chain;
                    if SetCnt =3 then Set3 := Chain;
                    if SetCnt =4 then Set4 := Chain;
                    if SetCnt =5 then Set5 := Chain;
                    StringVar chain := ', ' &#38; Item)
            else if chain = "" 
                    then chain := Item 
                    else chain := chain + ', ' + Item;
Setcnt &#38; ' ' &#38; Chain&lt;/code&gt;


Regards,
Dan</description>
		<content:encoded><![CDATA[<p>Ken,</p>
<p>Thanks very much for all that you do in putting this Crystal information out there.</p>
<p>In this blog entry the code from Shelly generally works, but includes dead code and dead variables.  Note that the variable ChCnt is only set to the value of 2 (other than 0 initially), but is tested for a value of 1.</p>
<p>Below I have eliminated the dead code and variable plus I added a simple test that eliminates the comma from the beginning of the resulting composite string.</p>
<p><code>WhilePrintingRecords;<br />
StringVar Item:= {your.stringfield};<br />
StringVar Chain;<br />
NumberVar ChCnt;<br />
NumberVar SetCnt;<br />
StringVar Set1;<br />
StringVar Set2;<br />
StringVar Set3;<br />
StringVar Set4;<br />
StringVar Set5;</code></p>
<p><code>if Length(Chain) + Length(Item) &gt; 200<br />
            then (SetCnt := SetCnt + 1;<br />
                    if SetCnt =1 then Set1 := Chain;<br />
                    if SetCnt =2 then Set2 := Chain;<br />
                    if SetCnt =3 then Set3 := Chain;<br />
                    if SetCnt =4 then Set4 := Chain;<br />
                    if SetCnt =5 then Set5 := Chain;<br />
                    StringVar chain := ', ' &amp; Item)<br />
            else if chain = ""<br />
                    then chain := Item<br />
                    else chain := chain + ', ' + Item;<br />
Setcnt &amp; ' ' &amp; Chain</code></p>
<p>Regards,<br />
Dan</p>
]]></content:encoded>
	</item>
</channel>
</rss>
