Print Page | Close Window

Removing Row

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=10440
Printed Date: 10 November 2024 at 7:11am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Removing Row
Posted By: cmm2006
Subject: Removing Row
Date Posted: 01 May 2008 at 6:02pm
Ok I know it's easy to do, but for some reason, I was unable to get it done. the report control contain all the records of a table, and I need to know how to remove some rows from the report base on the selection of the user (selection is made from a combobox).
I want all the records that their value are not = to item(5) of the report control.
please help
 



Replies:
Posted By: Aaron
Date Posted: 02 May 2008 at 5:19am
Hi,
 
Your question isn't very clear to me. You want to remove a record from the Reportcontrol, that part I did understand. 
 
*    Is it the focused/selected record or a reference/index of the record selected with the combobox? 
*    You want all the records that their value are not = to item(5) of the report control??? This part I really don't understand.
*    And what version do you use?
 
Explain what you really want, with text, screenshot or whatever  
 


Posted By: cmm2006
Date Posted: 02 May 2008 at 7:28am
ok, I have a report control with 6 columns, and records are loaded to the reportcontrol. now I have a combobox where the user can select what they to show only in reportcontrol.
for example the 5 column of the report control containt the state of residence, and the combobox contain all the 50 states, now if the user select 'FL' from the combobox, all I want to be displayed in the reportcontrol is the customer who reside 'FL' state.
CJ12
 


Posted By: Aaron
Date Posted: 02 May 2008 at 8:49am
Hi,
 
So you really want to "sort" the items which match the selected combo text? If you want to sort the records on selected combo text you can traverse the records and set the found recorditem (row) to visible
 
 
Private Function SortSelectedComboText()
    Dim record As ReportRecord
   
    For Each record In wndReportControl.Records
        record.Visible = True 'make previous sort undone when row was set to  invisible
        If Not UCase(record(the index of the column to search comes here).Value) Like "*" & UCase(Combo.Text) & "*" Then 'compare value the RecordItem of record with combo selected text
            record.Visible = False
        End If
    Next record
   
    wndReportControl.Populate 'show the found records
   
End Function
 
 
Note: The * in the line "*" & UCase(Combo.Text) & "*" will be used for any character before / after the selected combo text. If you want to search exact, just use Combo.Text
 
  
Hope this will help.


Posted By: cmm2006
Date Posted: 02 May 2008 at 11:44am
No, I am not looking to sort the report.
okay how can remove row from reportcontrol?
thank you


Posted By: joeliner
Date Posted: 02 May 2008 at 1:07pm
Originally posted by cmm2006 cmm2006 wrote:

No, I am not looking to sort the report.
okay how can remove row from reportcontrol?


i think cmm2006 is referring to filtering the records where in essence the records are hidden. filtertext would be the way to go then.

http://forum.codejock.com/forum_posts.asp?TID=10180

BTW, thanks Aaron for posting ths snippet. was really helpful. :) Am trying to work on the RC subtotal. http://forum.codejock.com/forum_posts.asp?TID=9801. i dont mind sharing it if am successful.

regards,


Posted By: Aaron
Date Posted: 02 May 2008 at 4:02pm
Originally posted by cmm2006 cmm2006 wrote:

No, I am not looking to sort the report.
okay how can remove row from reportcontrol?
thank you
 
It's not sorting records in a way you think (look at the quotes, "sort"), It's more filtering the ReportControl's records and show the result to the user.
 
Do you want to "remove" a row (make invisible) or remove the record? You have to be more clear when asking a question and sometimes it helps when you would upload a screenshot. Now...  
 
Make row invisible without removing the actual record:
 
wndReportControl.Rows(wndReportControl.FocusedRow.Index).record.Visible = False 
wndReportControl.Populate
 
or
 
wndReportControl.Records(wndReportControl.FocusedRow.Index).Visible = False 
wndReportControl.Populate
 
Remove the record from the ReportControl:
 
wndReportControl.Records.RemoveAt wndReportControl.FocusedRow.Index
wndReportControl.Populate
 
I have used the current selected record in the lines of code (above)
 
If you are going to make the record/row invisible you have to keep track of the rows which are invisible or just loop through the records and make them all visible. I don't have a clue what you are trying to accomplish, it looked like you wanted just those records to show, the user selected but you don't want that.
 
But maybe you can take a closer look at the sample project:
http://forum.codejock.com/forum_posts.asp?TID=10180 - http://forum.codejock.com/forum_posts.asp?TID=10180


Posted By: Aaron
Date Posted: 03 May 2008 at 1:07pm
Originally posted by joeliner joeliner wrote:

 
i think cmm2006 is referring to filtering the records where in essence the records are hidden. filtertext would be the way to go then.

regards,
 
Joeliner, FilterText will filter entire ReportControl's records and not just one column. With my snippet you can filter a column you want.


Posted By: cmm2006
Date Posted: 03 May 2008 at 2:09pm
thank you Aaron for all your help, make row visible/invisible did the job.


Posted By: Aaron
Date Posted: 03 May 2008 at 2:22pm
Hi,
 
Glad I could help you, thats why we are here, right
 
Did you check the sample project I posted? I guess you want the same as I showed in the sample. Just showing those records which the user selects.


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



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