Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - FilterText question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

FilterText question

 Post Reply Post Reply
Author
Message
msotocl View Drop Down
Groupie
Groupie


Joined: 05 March 2008
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote msotocl Quote  Post ReplyReply Direct Link To This Post Topic: FilterText question
    Posted: 10 April 2008 at 5:12pm

Hi,

I have a version 11.2.  (Good version), i have a 2 question:

 
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
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 21 April 2008 at 2:34am
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
 
 
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Posted: 21 April 2008 at 8:27pm
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
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 22 April 2008 at 8:27am

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  

Back to Top
msotocl View Drop Down
Groupie
Groupie


Joined: 05 March 2008
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote msotocl Quote  Post ReplyReply Direct Link To This Post Posted: 28 April 2008 at 9:20pm
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
 
 
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 29 April 2008 at 5:54am
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.
 
 
Back to Top
msotocl View Drop Down
Groupie
Groupie


Joined: 05 March 2008
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote msotocl Quote  Post ReplyReply Direct Link To This Post Posted: 30 April 2008 at 5:03pm
Hi


Thank you for your help... but the sample not work...
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2008 at 12:25am
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..."
 
 
 
 
Back to Top
msotocl View Drop Down
Groupie
Groupie


Joined: 05 March 2008
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote msotocl Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2008 at 5:27pm


OK. 

Now I understand all....This one very good

Thank you very much
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.