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!

Multiple Record Selections

Status
Not open for further replies.

benchmead

IS-IT--Management
Aug 6, 2002
4
US
let me give you some background. We sell Cable equipment and each piece of equipment is given a Cat Code. the Cat code is a 4 char. string but we decided to use numbers. the first two numbers are the vendor (ex. 01 = Sony, 30 = Magnavox). The last two numbers are the type of equipment (ie. 10 = TV, 20 = Game Consoles) so a cat code 0120 would bring up all types Game Consoles that Sony Makes. So, I have created a report that prompts for start and end Vendor Cat and start and end Product Cat. I then concatinated the two in to the actual cat code. I would like to make the Record Selection see all (Game Consoles) that all companies make. All I have to do is add 100 to the Cat Code, but I can't figure out how to do this. PLEASE HELP!!!!!

===========================================================
Here is my code if it helps
===========================================================
local stringVar CurrentCat := {?Start Cat};
local NumberVar beer := CDbl (CurrentCat);
local NumberVar Counter := 1;
local NumberVar StartNo := CDbl ({?Start Cat});
local stringVar EndNo := {?End Cat};
local StringVar Array x;

//it calculates only that type of equipment but for all companies.
while CurrentCat < {BKICMSTR.BKIC_PROD_CAT} Do
(
x [counter] := CurrentCat;
beer := beer + 100;
CurrentCat := CStr (beer);
Counter := Counter + 1;
);
{BKICMSTR.BKIC_PROD_CAT} = x
 
So you have a start and end vendor code and a start and end equip code - in the Db its stored in one field as XXYY where XX = Vendor, YY = Quip.

You can select all records by applying the selection formula

Left({CatCode},2) in {?StartCat} to {?EndCat) and
Right({CatCode},2) in {?StartEquip} to {?EndEquip}

I am assuming the parameters are numeric.

Hope I interpreted your request correctly...let me know if not.
Steve Phillips, Crystal Consultant
 
The Cat Code is a 4 char string (ie 4450, 4405). I am wanting to display for example all Game Consoles ie
0123 = Sony Game Consoles
0223 = Magnavox Game Consoles
0323 = Nintendo Game Consoles
0423 = Mitsubishi Game Consoles
and I want it to keep going till the {?EndCat} is met.

Thanks
 
Sorry, you already said they are strings. I still think my solution will work though. Here's the reworked selection criteria (very similar but with better names):

Left({CatCode},2) in [{?StartVend} to {?EndVend)] and
Right({CatCode},2) in [{?StartProd} to {?EndProd}]

Perhaps the problem is with the grouping. The above should select all Vendors within range and all Products within range.

If you want to display the same products grouped together , you will need to group on a the Right 2 Chars of the CatCode, then the Left 2 characters of the CatCode. Create a formula for these and group by them. Steve Phillips, Crystal Consultant
 
Watch the record selection criteria to assure that you're getting pass thru SQL, using variables in the code will likely prevent this.

Steve's solution looks like it will probably pass the SQL, if not, create formulas to house therm and then use them in the record selection criteria, and again, do NOT use variables.

-k kai@informeddatadecisions.com
 
SMPhillips, thanks for your advice. It worked like a charm. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top