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

Removing Row

 Post Reply Post Reply
Author
Message
cmm2006 View Drop Down
Senior Member
Senior Member


Joined: 26 September 2006
Status: Offline
Points: 118
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmm2006 Quote  Post ReplyReply Direct Link To This Post Topic: Removing Row
    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
 
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: 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  
 
Back to Top
cmm2006 View Drop Down
Senior Member
Senior Member


Joined: 26 September 2006
Status: Offline
Points: 118
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmm2006 Quote  Post ReplyReply Direct Link To This Post 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
 
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: 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.
Back to Top
cmm2006 View Drop Down
Senior Member
Senior Member


Joined: 26 September 2006
Status: Offline
Points: 118
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmm2006 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
joeliner View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 June 2006
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeliner Quote  Post ReplyReply Direct Link To This Post 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,
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: 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:
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: 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.
Back to Top
cmm2006 View Drop Down
Senior Member
Senior Member


Joined: 26 September 2006
Status: Offline
Points: 118
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmm2006 Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2008 at 2:09pm
thank you Aaron for all your help, make row visible/invisible did the job.
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: 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....
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.170 seconds.