Link to home
Start Free TrialLog in
Avatar of moneyfool
moneyfool

asked on

Concatenate the string variable into 1 formula cell ! String greater than 254 characters?


I have 3 formula fields in the sub-report Footer. Each act as a footnote to the entire report. In the report I have declared 3 global variables in the main report.
In the report the variable gets a value assigned and maybe none assigned and that displays as the footnote.

E.g:
Variable decleared in the report header as A, B, C
shared stringVar A;
shared stringvar B;
shared stringvar C;

In the report in formula fields they above variables get some value
A - AAA
B - BBB
C - CCC

Now if in the sub-report footer, if I have separate formula cells referencing each of the above than the report displays them.

I want them to be in 1 formula cell with chr(13) - carriage return between them. How can i do that? I tried
shared stringvar A;
shared stringvar B;
shared stringvar C;

A + chr(13) + B + chr(13) + C;

But the above returns only one value and not all the variable value?

Also, if the string A is more than 254 character than what is the next best thing that I can do? Thanks
Avatar of DRRYAN3
DRRYAN3

Hi moneyfool

At the point where you want your footer variables concatenated, try something along these lines in a formula:

global stringvar FooterA;
global stringvar FooterB;
global stringvar FooterC;
stringvar RetStr := "";

FooterA := trim(FooterA);
FooterB := trim(FooterB);
FooterC := trim(FooterC);

if len(FooterA) > 0 then
  RetStr := FooterA;

if len(FooterB) > 0 then
  if len(RetStr) > 0 then
    RetStr := RetStr + chr(10) + chr(13);
  RetStr := RetStr + FooterB;

if len(FooterC) > 0 then
  if len(RetStr) > 0 then
    RetStr := RetStr + chr(10) + chr(13);
  RetStr := RetStr + FooterC;

RetStr;

Place the variable field where you want to see the concatenated results and be sure to set the Can Grow check mark for that field.

Where are you bumping against the 254 character limit?

DRRYAN3
Avatar of moneyfool

ASKER

Thanks again. Yes the code does work. But the FooterA variable is more than 254 characters. so thats the issue. whenever A is present the 254 error appears. When A is not present than it is fine since B and C are way less than 254.

I tried using another variable RetStr2 but does not work real well. any ideas?
In trying to duplicate your problem with the string longer than 254 characters, I cannot find a way to assign more than 254 before getting an error message.  Is it the case that A is less than 254, but when you add B and C to the end it becomes more than 254?
A is around 200 characters but than B is around 56 characters and C is around 65 characters. So A by itself should be fine, only when added with B or C crosses 254 character limit.

Only B+C is also fine
ASKER CERTIFIED SOLUTION
Avatar of DRRYAN3
DRRYAN3

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
moneyfool

Did you have any success with arrays of strings?

DRRYAN3
moneyfool

Feedback please?
thanks ryan

was out for few days. the above link is good but needs lot of work around the code. i am still looking into but hopeful that it will work. when i get the code working shall post out. thanks
Glad to hear it.  DRRYAN3