Subset of BO's data


Author
Message
Ian Hammond
Ian Hammond
StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)
Group: Forum Members
Posts: 57, Visits: 277
I have a table comprising a list of file paths for images and an associated identity. Images for the same item share the same identity. I have loaded the entire data into the BO to save on accesses to the database. My intention is to get a subset of the data using the associated identity, but I'm not sure how to achieve this. Can anyone point me in the right direction.

Many thanks in advance.

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Ian,



I don't quite understand what you want here, so please explain in more details if possible.



If you need to get a subset of data, simply create a method in the BO with the desired SQL SELECT to get the subset of data you want to have in the BO, then call this method whenever you need it to fill the BO with that data. If this is what you are looking for, here is a sample code:





Public Sub FillByAllTenantAptNumber(ByVal pCity as String)

Using cmd As New SqlCommand()

cmd.CommandText = String.Format("SELECT DISTINCT Apt_No From {0} WHERE City = @City ORDER BY Apt_No", Me.TableNameAndSchema)

cmd.Parameters.AddWithValue("@City", pCity ).SqlDbType = SqlDbType.VarChar



Me.FillDataTable(cmd)

End Using

End Sub



Edhy Rijo

Ian Hammond
Ian Hammond
StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)
Group: Forum Members
Posts: 57, Visits: 277
Hi,

Thanks for your response. I realise that I could just stick a method that populated the BO with a subset of the data collection, but I thought that this would have to make a connection to the database each time I changed  item in the main table.  Hence, I thought I should populate the BO with the references and then get a subset from this each time I stepped through the main table. I thought that the Filter would do the trick but I can't find any info about how to use it and if its the right method for what I'm trying to achieve.

Regards

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Ian Hammond (05/24/2010)
I thought that the Filter would do the trick but I can't find any info about how to use it and if its the right method for what I'm trying to achieve.




Thanks for explain.



Yes the BO.Filter will give you what you want, just need to use it carefully because the filter will affect the BO.CurrentView and BO index, so the bo.Count will reflect the records shown in in the CurrentView which may be filtered or not.



There are plenty of samples on how to use the filter here in the forums and also in the help file.



Basically you add the filter like: bo.Filter = "MyFieldName=" & FieldValue, then to reset the filter just set it to blank space bo.Filter = ""



Hope this help.






Edhy Rijo

Ian Hammond
Ian Hammond
StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)StrataFrame Novice (65 reputation)
Group: Forum Members
Posts: 57, Visits: 277
Many thanks for that pointer, it helped a great deal.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search