Print Page | Close Window

FilterText question

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=10180
Printed Date: 29 April 2024 at 2:21am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: FilterText question
Posted By: msotocl
Subject: FilterText question
Date 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



Replies:
Posted By: Aaron
Date 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
 
 


Posted By: nighthawk
Date 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


Posted By: Aaron
Date 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  



Posted By: msotocl
Date 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
 
 


Posted By: Aaron
Date 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.
 
 
https://forum.codejock.com/uploads/20080429_153244_TestSorting.zip - uploads/20080429_153244_TestSorting.zip


Posted By: msotocl
Date Posted: 30 April 2008 at 5:03pm
Hi


Thank you for your help... but the sample not work...


Posted By: Aaron
Date 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..."
 
 
 
 


Posted By: msotocl
Date Posted: 01 May 2008 at 5:27pm


OK. 

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

Thank you very much



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net