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!

Parse Parameter for Record Selection 1

Status
Not open for further replies.

McSys

Programmer
Jul 10, 2001
18
US
Using Crystal Reports 10 against a SQL Server 2000 database and having a problem with parameter fields and record selection.
The table has fields Job # and Part # (can have multiple parts per job). Need to have the user enter several job numbers and a specific part on that job for the report. Example,
Job # Part #
10001 2
10005 1
10007 3
etc.
The parameter field allows multiple values. Want the user to enter a job number and part number into a parameter field in the format (job_no dash part_no, or, #####-#).
How can I process the parameter array to parse the job number and part number fields and put into the record selection?
Your input is greatly appreciated.
Thanks.

 
A simpler method would be to build a SQL Expression on the database which has something like:

rtrim({table.jobs})+'-'+rtrim({table.parts})

Now you can just use this SQL Expression as the source for the record selection, as in:

{#jobpart} in {?parameter}

If you must do this within Crystal:

Here's a formula to return the parts:

stringvar array Parts;
numbervar counter;
redim Parts[ubound({?arraying})];
For counter := 1 to ubound({?arraying}) do(
Parts[counter]:=split({?arraying}[counter],"-")[2]
);
1

Here's the formula to gather the Job:

stringvar array Job;
numbervar counter;
redim Job[ubound({?arraying})];
For counter := 1 to ubound({?arraying}) do(
Job[counter]:=split({?arraying}[counter],"-")[1]
);
2

Then the record selection would be:

stringvar array Parts;
stringvar array Jobs;
{table.parts} in Parts
and
{table.jobs} in Jobs

Again, this won't pass to the database for server side processing, so go with the SQL Expression.

-k
 
WOW!
Thanks synapsevampire. Actually thanks doesn't seem to quite justify it. The SQL Expression worked like a charm with no sacrifice in performance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top