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!

Eliminate ampersand in Crystal multiple check boxes 2

Status
Not open for further replies.

drkarr

IS-IT--Management
Aug 10, 2005
24
US
Data entered in Crytal 10 multiple check boxes are stored as ampersand delimited text strings, such as:

&friend&family&neighbor&email&flyer&other&

What is the best way to extract the data in readable form, such as:

friend; family; neighbor; email; flyer; other

OR

friend
family
neighbor
email
flyer
other

Thanks for your help.
 
Hi,
The
Split (inputString, delimiter)
operator will create an array containg the string's components...
So a formula that uses it would allow you to:

Join(<yourstring>,'&')

and
After that cycle through its members and display them as needed..

Look at the CR help for array usage..







[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
You can't create nor enter data in a check box in Crystal, in fact Crystal doesn't have check boxes.

So assuming that you mean a parameter, then reference it as Turk suggested, as in:

split(Join({?MyParm},'&'),";")

or to have them on seperate lines, use:

split(Join({?MyParm},'&'),chr(13))

and make sure that you turn on Can Grow for the formula.

If you're speaking of some check box code that was written as a front end for Crystal, you need to share the code.

Keep in mind that a check box is a boolean, not a value, so this all sounds very strange as described unless you speak of some front end code.

In either case, if you have access to the concatenated string within the report then the above solutions should work.

-k
 
Thanks to Turkbear and synapsevampire for valuable insight. Indeed, the check boxes referred to are in the database application from which data are extracted for use in Crystal. I don't have access to the application code, however the data are contained in two fields in two forms. The first field is called "code" and looks like this:
1&2&3&4
A second field called "value", which is related to the first, looks like this:
&red&white&blue&green&
Your suggestions would seem to deal with one or both of these, but I haven't had success in making it happen. Any additional help will be much appreciated.
 
Hi,
If they are data fields ( first, find out who designed that data model and punish them) then you can use the functions to 'parse' the contents.

@getcode
Code:
split({code},'&')
@getvalue
Code:
split({value},'&')

If both fields will ALWAYS have the same number of elements, you can , for instance, create a formula to combine Code and Data into a string of value pairs, something like this should work:

@combothem
Code:
StringVar array Codes := split({code},'&');
StringVar array Values := split({value},'&');
StringVar str := "";
NumberVar strLen := UBound(Codes);
Local NumberVar i;
For i := 1 To strLen Do
(
    NumberVar charPos := strLen - i + 1;

   str := str + Codes[charPos] + '=' + Values[charPos]
);

str








[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks a ton, Turk. That cracked the nut!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top