Removing Row |
Post Reply |
Author | |
cmm2006
Senior Member Joined: 26 September 2006 Status: Offline Points: 118 |
Post Options
Thanks(0)
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
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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
|
|
cmm2006
Senior Member Joined: 26 September 2006 Status: Offline Points: 118 |
Post Options
Thanks(0)
|
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
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.
|
|
cmm2006
Senior Member Joined: 26 September 2006 Status: Offline Points: 118 |
Post Options
Thanks(0)
|
No, I am not looking to sort the report.
okay how can remove row from reportcontrol?
thank you
|
|
joeliner
Senior Member Joined: 09 June 2006 Status: Offline Points: 273 |
Post Options
Thanks(0)
|
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, |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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:
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Joeliner, FilterText will filter entire ReportControl's records and not just one column. With my snippet you can filter a column you want.
|
|
cmm2006
Senior Member Joined: 26 September 2006 Status: Offline Points: 118 |
Post Options
Thanks(0)
|
thank you Aaron for all your help, make row visible/invisible did the job.
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.... |
|
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 |