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 into parameter for CR report 1

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 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
        strCat = strCat.Replace(" ", ", ")  'what about last comma, need to remove, but how?

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.

Also, I know i will need to remove the last COMMA in the string, how do I do that?

Any ideas or suggestions on what to do?
 
Can't help for CRs. ( not worked with it yet )

To remove the last comma and space:
strCat = strCat.Substring(0, strCat.Length - 2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top