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 Westi 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 nest these functions in Crystal??? 2

Status
Not open for further replies.

jlclancy

Technical User
May 22, 2009
13
If I put them both in one or the other will stop working...

Removes white spaces...
stringvar input := {tbl.col};stringvar output := '';numbervar i;input := Trim(input);for i := 1 to Length(input)
Step 1 do if not(input in [Chr(13),Chr(10)])
then output := output + input;output;

Removes brackets...
trim(replace(Replace ({tbl.col}, "]","" ),"[", ""))

Also, if possible, how can I get the "can grow" option to work?
 
Hi,
try adding the trim to the output:
Code:
stringvar input := {tbl.col};
stringvar output := '';
numbervar i;
input := Trim(input);
for i := 1 to Length(input) 
do 
if not(input[i] in [Chr(13),Chr(10)]) 
then output := output + input[i];
trim(replace(Replace (output, "]","" ),"[", ""));





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi again,
I missed the second question:

What issues are you having with the 'can grow' option?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
That worked perfect, thank you!

As you can imagine, once the brackets and white spaces are removed there is a lot of new space; the field does not adjust.

Also, do you know a way to delete the text between the brackets. I was using this code; it does not work once it finds the first set of brackets and text.

if right({tbl.col},1) = "]" then
left({tbl.col},instr({tbl.col},"[")-1)
else
{tbl.col}
 
...eg,
stringvar input := {tbl.col};
stringvar output := '';
numbervar i;
input := Trim(input);
for i := 1 to Length(input)
do
if not(input in [Chr(13),Chr(10)])
then output := output + input;
if right(output,1) = "]" then
left(output,instr(output,"[")-1)
else
{tbl.col};
 
I am back to a nesting issue. I got this GREAT code; I do not know how to nest it with the white spaces code?

stringvar array x := split({tbl.col},"]");
numbervar i;
numbervar j := ubound(x);
stringvar y := "";
for i := 1 to j-1 do(
y := y + trim(extractstring(x,"","["))+"; "
);
if len(y) > 2 then
left(y, len(y)-2)
 
Try this:

stringvar k := replace(replace({tbl.col},chr(13),""),chr(10),"");
stringvar array x := split(k,"]");
numbervar i;
numbervar j := ubound(x);
stringvar y := "";
for i := 1 to j-1 do(
y := y + trim(extractstring(x,"","["))+"; "
);
if len(y) > 2 then
left(y, len(y)-2)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top