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

string from .NET over into parameter for search

Status
Not open for further replies.

Hueby

MIS
Oct 20, 2004
321
US
Hello all,

I have a basic .Net app that pushes a string (strCat) over into a crystal report 10 parameter {?@cat} .

The app has a bunch of checkboxes, once the user checks them and wants to run the report this code runs:

Code:
 Public Sub checkboxes()
        strCat = ""
        If CheckBox1.Checked = True Then
            strCat = "ABRA "
        End If
        If CheckBox2.Checked = True Then
            strCat += "BRUS "
        End If
        If CheckBox3.Checked = True Then
            strCat += "BUCK "
        End If
        If CheckBox4.Checked = True Then
            strCat += "COVE "
        End If
        If CheckBox5.Checked = True Then
            strCat += "HOSE "
        End If
        If CheckBox6.Checked = True Then
            strCat += "PART "
        End If
        If CheckBox7.Checked = True Then
            strCat += "ROLL "
        End If
        If CheckBox8.Checked = True Then
            strCat += "SASP "
        End If
        If CheckBox9.Checked = True Then
            strCat += "TAPE "
        End If
        If CheckBox10.Checked = True Then
            strCat += "TOOL "
        End If
        If txtCinput.Text <> "" Then
            strCat += txtCinput.Text
        End If

        'go through and insert COMMA where spaces, take out last comma
        strCat = strCat.Replace(" ", ", ") 
        strCat = strCat.Substring(0, strCat.Length - 2)


This then merges these categories together into a string. For example "HOSE, TOOL, ABRA". I then use this string (strCat) as a parameter {?@cat} in a crystal report. It does a search funtion for data. This code is below:

Code:
{IM_ITEM_MASTER_MC.Item_Category} in [{?@cat}]

The problems are: It doesn't work. Now if I manually set the strCat to be = "HOSE" it works. If I add a = "HOSE, TOOL" it does NOT work. If I manually enter it in Crystal Reports and run the report, it does work.

Any ideas or suggestions on what to do? Could this be on the CR end?
 
Hi,
Before sending the string to Crystal, display it ( maybe to a Label control) so you can see exactly what is being sent..There may be an issue with quotes or commas..
Also be sure the parameter is defined so as to allow multiple, discrete values..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top