I'm using NetAdvantage 12.1 and I'm unable to initially filter data via the Filters property on a FlatDataSource defined in XAML or code behind.
I'm using the following object:
class Transaction{ public string Name {get;set;} public DateTime Date {get;set;} public decimal Amount {get;set;} public bool IsDeleted {get;set;}}
With this XAML markup:
<igOlap:FlatDataSource Cube="Transaction" Rows="[Name].[Name]" Columns="[Date].[Date]" Filters="[IsDeleted].[IsDeleted]{[IsDeleted].[IsDeleted].&[FALSE]}" Measures="Amount" />
My problem is that the Filters area shows the correct item (IsDeleted), but the 'FALSE' filter is not applied when loading the grid. I can manually check/uncheck the TRUE and FALSE filter checkboxes and when clicking Ok the filter works fine, but I want to have the underlying dataset filtered when loading the grid for the first time.
For some reason, the XamPivotGrid seems to ignore the curly bracket part (...{[IsDeleted].[IsDeleted].&[FALSE]}...).
Can you please show me how to achieve that? Thanks for your help
No worries Plamen, I actually got it working after doing some try and error attempts.
What I ended up doing was looping through the Filters FlatDataFilterViewModel objects to identify the correct filter view model. Then I'm manually setting the IsSelected property of the IFilterMember objects and call CommitChanges() on the FlatDataFilterViewModel before doing a RefreshGrid().
This seems to do the job, thanks for looking into this as well.
ok, I see.
Unfortunately, pre-filtering would be essential for what we are trying to achieve. I'm not sure whether this is possible, but can you think of any way this could be simulated from code behind? For example, would it be possible to access the filter area object and manually set the filter value after the data was bound?
In other words, is there a way to manually trigger the event which gets fired when the user hits the "Filter -> Values -> Ok" mouse button from code behind?
Thanks again for your fast reply and for looking into this :)
Hello Roman,
After the research I've made I found the pre-filters were never supported for FlatDataSource.We can log that as a feature request.
Regards.Plamen.
Hi Plamen, thanks for your fast reply.
This filter value doesn't seem to work either. I've attached the Xaml file with code behind (modified from the Infragistics WPF Startup Solution).
Can you please show me how to make this work based on those files? (I'm using XamPivotGrid v12.1)
Thanks,
Roman
Hello,
For the pre-filtered values the pivot grid relies on member's unique name, so I guess the expression in your case has to be:
"[IsDeleted].[IsDeleted]{[IsDeleted].[IsDeleted].[IsDeleted].&[FALSE]}"
The difference is the level name part is added to form the unique name of the member.
Best regards.Plamen.