Here's what I did that seems to work and play well with SF BOs
_ExcludedTemplateKeys is a list of iTemplatekey (system.int32) obtained from another BO
Dim query = From bo In me.templatesbo1.Getenumerable() _
Where Not _ExcludedTemplateKeys.Contains(me.templatesbo1.ikey) _
Select Me.TemplatesBO1.ikey
Need to
explicitly use me.TemplateBO1 rather than bo or the compiler complains about attempting to use late binding.
The resulting query can then be used in fillbyprimarykey if you pass it in converted from a list to an array
Me.TemplatesBO1.fillbyprimarykey(query.toarray())
This works, but ...
In this case I already have the TemplateBO1 filled with all records ( which I am using in the LINQ above ) and I would prefer to keep the thrashing local rather than do another pull from the back end.
For that reason,
I'd like to set a filter on TemplateBO1 based on the list of keys ( if I could do that I wouldn't even need the LINQ query here but could just set a filter on TemplatesBO1 once I knew which keys to exclude ) rather than fill the TemplatesBO1 again (and perhaps have to fill it again with all records if I need to repeat the process)
So a solution that involves filtering the local datatable rather than refilling it from the backend would be preferred.
But
Me.TemplatesBO1.filter = "query.contains(ikey) = false"
and numerous variants give me the
runtime error that I am trying to use an undefined function in a filter. (is there a way to define the function that the filter can use it - tried to create an outside function wrapping query.contains() that returned a boolean but got the same result when I used it in the filter string at runtime)
plan B : I would like to
fill my checked listbox from TemplatesBO1 based on a subset as if the filter had been applied, if it is not practical to filter the BO itself based on a function.
In that approach, I can easily get a LINQ cursor from TemplatesBO on that criteria.
How would I tell the checked listbox to copy data from the query result into it's data source??or is there a way to fill the datasource of the checked list box with a filter condition without actually changing the filter on the BO
Sorry for these long stream of consciousness posts, but I think I'm right on the edge here of figuring out some techniques that are going to be really useful in munging data locally
I am doing a lot of wizards right now and there are a whole lot of BOs talking to each other. If I can nail down some best practices on this stuff I think this is going to be way easier than Fox ever was.