FilterText question |
Post Reply |
Author | |
msotocl
Groupie Joined: 05 March 2008 Status: Offline Points: 16 |
Post Options
Thanks(0)
Posted: 10 April 2008 at 5:12pm |
Hi, 1.- how to make a search of filltertext but only of selected column
2.- How to make a fixedrows (how to subtotals), but displayed in the end of a sumatory i.e, not only in header or footer
Thank you very much
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
I guess it's not possible to filter on just 1 colum. The filter applies on every column in the ReportControl. I don't know what you need this for but you could add some code in the BeforeDrawRow event to "filter" the column you want.
If Item.Index = 1 Then
If Metrics.Text Like "*" & wndReportControl.FilterText & "*" Then Metrics.Font.Bold = True Else
Metrics.Font.Bold = False
End If
End If |
|
nighthawk
Senior Member Joined: 11 June 2004 Status: Offline Points: 167 |
Post Options
Thanks(0)
|
You can write your own custom filter function. Here is a modified version of what I use. I didn't actually test this version so there may be a bug or two that needs worked out:
Private Sub filterRows2(p_objGrid As XtremeReportControl.ReportControl, p_strFilterText As String, p_lngColumnID As Long) Dim Record As XtremeReportControl.ReportRecord Dim i As Long Dim strValue As String Dim strCaption As String Dim bolVisible As Boolean On Error GoTo filterRows2_Error ' initially make all records visible For i = 0 To p_objGrid.Records.Count - 1 Set Record = p_objGrid.Records(i) Record.Visible = True Next i If (p_strFilterText <> "") Then 'loop through all rows and check filter text against value and caption of specified column For i = 0 To p_objGrid.Records.Count - 1 Set Record = p_objGrid.Records(i) strValue = Record.Item(p_lngColumnID).Value strCaption = Record.Item(p_lngColumnID).Caption If ((isStringInString(LCase$(p_strFilterText), LCase$(strValue)) = True) Or _ (isStringInString(LCase$(p_strFilterText), LCase$(strCaption)) = True)) Then Record.Visible = True Else Record.Visible = False End If Next i End If Set Record = Nothing p_objGrid.Populate On Error GoTo 0 Exit Sub filterRows2_Error: End Sub Public Function isStringInString(p_strIsThisString As String, p_strInThisString As String) As Boolean On Error GoTo isStringInString_Error If (InStr(p_strInThisString, p_strIsThisString) <> 0) Then 'if not 0, then it is in target string isStringInString = True Else 'if equals 0, then not in string isStringInString = False End If On Error GoTo 0 Exit Function isStringInString_Error: isStringInString = False End Function |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi NightHawk Did you try this with 1,5 million records? With my solution it doesn't matter if there are 10.000.000 records or just 1 |
|
msotocl
Groupie Joined: 05 March 2008 Status: Offline Points: 16 |
Post Options
Thanks(0)
|
Hi.
i not undestand your example...
please see the image:
i need make a filter only on column selected: In this case Column "Nombre Producto". I write a text in superior right text box and need, what the report control only search the text in selected column ("Nombre Producto")
any idea
thank you very much
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
This is a sample project how to sort on a certain column. The ReportControl is V11.1 (I don't have an earlier version). Just replace the ReportControl with your own version if necessary.
|
|
msotocl
Groupie Joined: 05 March 2008 Status: Offline Points: 16 |
Post Options
Thanks(0)
|
Hi
Thank you for your help... but the sample not work... |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
What doesn't work?
Right clicking a column will select the column and enter your sort text. The * will replace all chars beginning with "Data..."
|
|
msotocl
Groupie Joined: 05 March 2008 Status: Offline Points: 16 |
Post Options
Thanks(0)
|
OK. Now I understand all....This one very good Thank you very much |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |