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

New SQL software, new string, need to group 1

Status
Not open for further replies.

BHERNANDEZ

Technical User
Mar 4, 2003
24
US
I am using CR 7 with a SQL database. MY old program was Btreive and had separate fields for customer orders for the CITY, STATE, and ZIP. The new SQL program has combined the three into one field called {Addr Line 3}. I have a report that selects only certain states. How can I group these states? My selection criteria looks like this:

{OEHDRHST_SQL.ship_to_addr_3} like ["*** AK ***", "*** AL ***", "*** AR ***"]

If I need to explain a little more, let me know. I tried this formula but receive the message that I need a field name between the paren ( and {oe}. I have tried various field names and I then receive the error that I can not group on a condition. I am sure this whole formula is not what I am looking for anyway. Help!!!

WHILEPRINTINGRECORDS;
STRINGVAR STATE := {OEHDRHST_SQL.ship_to_addr_3};

groupname ({OEHDRHST_SQL.ship_to_addr_3} like ["*** AK ***", "*** AL ***", "*** AR ***"])


BH
 
You could create a formula called state and put it in the detail section:

If {OEHDRHST_SQL.ship_to_addr_3} like "*** AK ***" then "AK" else
If {OEHDRHST_SQL.ship_to_addr_3} like "*** AL ***"
then "AL" else
If {OEHDRHST_SQL.ship_to_addr_3} like "*** AR ***"

Then use the state formula to group on.
 
Thanks! All I needed was that and now everything is flooding back to memory.

B
 
You might be better served to explicitly locate data, in either case, one asterisk will suffice.

And swat the dba around for joining these fields into one, that's a very poor design and will always cause problems going forward.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top