logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
arvind  
#1 Posted : Saturday, May 19, 2018 6:58:02 AM(UTC)
arvind

Rank: Newbie

Groups: Registered
Joined: 3/1/2018(UTC)
Posts: 7
India
Location: ahmedabad

i am using one filter and i select one value, every time i select differnt value, how can i get differnt view
epf  
#2 Posted : Tuesday, May 22, 2018 9:00:06 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
I made a quick try to enable the end-user to change the View executed:

1. Create 2 views named 'v1' and 'v2'

2. Create an enumerated list named 'View Names' with 2 values: v1, v2

3. Create your model, add a restriction with the following properties:
Name 'Choose a View Name'
Operator 'Value Only'
Prompt Restriction 'Prompt Only One Value'
Custom Enumerated List 'View Names'
Use as Parameter 'Yes'

4. Add a task with the following script:
Code:
@using Seal.Model
@{
    ReportTask task = Model;
    Report report = task.Report;
	ReportRestriction restriction = report.Models[0].GetRestrictionByName("Choose a View Name");
	if (restriction != null && restriction.EnumValues.Count > 0) 
	{
		var viewToExecute = report.Views.FirstOrDefault(i => i.Name == restriction.EnumValues[0]);
		if (viewToExecute != null) {
			report.LogMessage("Changing view to " + restriction.EnumValues[0]);
			report.CurrentViewGUID = viewToExecute.GUID;
		}
	}		
}


and this should work...

in attachment is my test report for Northwind
test change view.srex (14kb) downloaded 6 time(s).

Edited by user Thursday, May 24, 2018 5:10:50 PM(UTC)  | Reason: Not specified

Users browsing this topic
Guest (2)
Forum Jump  
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.