databand filter from VB.net

HI,


I have a filter on a databand that is linked to a prameter [STIAHD.INV_NUM]== ToDecimal([@INVNUM])

when the user clicks an Invoice in a datagrid on my form, i then set the parameter to the Invoice Number

and the previewcontrol displays ony that Invoice


this works well, however..... I need to display ALL the invoices, if there is no invoice selected in the datagrid

i tried

IIF([@INVNUM]=="","",[STIAHD.INV_NUM]== ToDecimal([@INVNUM]))

in the filter but that didnt work.


is it possible to add and remove the filter on the report databand from my vb.net program at runtime?

or is there a way of ignoring the filter if the parameter is "" or is nothing?


Thanks

Comments

  • i figured this out, (a good nights sleep helped!) so i thought i'd come back and answer my own question.

    maybe it helps someone else in future


     Dim b As DataBand = report1.FindObject("Data1")

     If dgvList.SelectedRows(0).Cells(1).Value.ToString = "Show All" Then

          b.Filter = ""

          report1.SetParameterValue("@Batch", Nothing)

        Else

          b.Filter = "[STIAHD.INV_NUM]== ToDecimal([@Batch])"

          Dim filterValue As String = dgvList.SelectedRows(0).Cells(1).Value

          report1.SetParameterValue("@Batch", filterValue)

        End If

        PreviewControl2.RefreshReport()

Leave a Comment