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

Array situation?

Status
Not open for further replies.

PAULCALLAGHAN

Technical User
Sep 4, 2001
165
CA
I have a situation where I'd like to test if a certain text string is contained within a particular field. e.g. "BROOME" in {ShipToName}. I found that I needed this test in several formulae. Now I'm finding that I need to expand on the text strings to test.

I'm not sure but would this be more efficient to set up all of these text strings as one array? I would then use this array in my formulae where I'm testing for the presence of one of those text strings.

How do I go about this though? I'm having trouble understanding the on-line help. I'm using Crystal 8.5.

Any other approaches would be greatly appreciated too!
 
Adding strings to test would be more like this:

{ShipToName} in ["BROOME", "MOPE", "DUSTPANE"]

Perhaps you could post an example of why you'd need several formulas, and that the intent is (is it to eliminate the rows from the data, include them, simply suppress but use them in final output, or?).

Posting example data and expected output should help everyone understand the requirements.

-k
 
Thank you syn, for the prompt reply.

If I use your suggestion for adding text strings I get the error message "The keyword 'then' is missing." I am using this test in an IF statement.

If I use square brackets around the group of text strings the formula is accepted as error free but it doesn't give the right result.

Explanation of situation,
I want to print out the consignee's name, addresses, city, state, and zip-code on separate lines of a report. Therefore I have to set up a formula for each of these. Within each formula I need to test for the presence of certain text strings to determine what exactly to print out for each of these values. Therefore I am constantly repeating this same text string test as an IF statement, and the number of text strings to test for is a small manageable group but there must be a more efficient way to handling it. That's why I'm thinking about the use of an array to define all such possible text strings.

Make sense?
 
I will repeat SV's request

An example would be appreciated.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Sorry, the TGL ripped my brackets out:

{ShipToName} in ["BROOME", "MOPE", "DUSTPANE"]

Text descriptions may help you understand the situation, but example data and expected output helps everyone.

To set up an address on a report, right click the details section and select insert section below.

Place each field(s) in their respective section, as in:

details A: Company
details B: Name
details C: Address1
details D: Address2
details E: Address3
details F: City, State ZIP

Now right click each section and select format section->Suppress blank section

If the intent is to only display some addresses, for instance those in California and Oregon, use the Report->Edit Selection Formula->Record and palce something like:

{table.state} in ["CA", "OR"]

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top