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
stis rapidum  
#1 Posted : Sunday, January 17, 2016 5:32:01 PM(UTC)
stis rapidum

Rank: Newbie

Groups: Registered
Joined: 1/17/2016(UTC)
Posts: 5
Russian Federation
Location: Moscow

Hi there!
I'm excited by your software and waiting for the 2.0 version.


I want to create my own restriction that switches shown data.

For example restriction has two values "profit sum" and "amount of orders" and depending on user's choice result table shows profit sum or amount of orders. How can I make it?


Best regards.
epf  
#2 Posted : Monday, January 18, 2016 10:41:40 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)
Actually it is an interesting question,
you can do that by doing this (you can get inspired by the sample 51-User input - Connection and threshold.srex):
  • Create your user input restriction
  • Then modify the Pre-Load Script of your model to remove the columns.
I made a sample 52 for the 2.0, the script looks like:
Code:
@using Seal.Model
@using System.Data
@{
    ReportModel model = Model;
	ReportExecutionLog log = model.Report;
	
	//Use the model tag to store the original elements for several executions...
	if (model.Tag == null) 
	{
		model.Tag = model.Elements.ToList();
	}
	else 
	{
		model.Elements = ((List<ReportElement>)model.Tag).ToList();
	}

	
	
	ReportRestriction restriction = model.GetRestrictionByName("Columns Displayed");
	if (restriction != null && restriction.EnumValues.Count > 0) 
	{
		log.LogMessage("{0} Columns selected. Removing columns not selected", restriction.EnumValues.Count);
		model.Elements.RemoveAll(i => !restriction.EnumValues.Contains(i.DisplayNameEl) && i.DisplayNameEl != "Category");
	}
}

Note the .Tag property is just available from the 2.0, you can get a beta at https://ariacom.com/download/sealsetup20.exe,
this should include the sample report 52...

Do not hesitate to send your feedbacks on the 2.0.

Edited by user Monday, January 18, 2016 10:42:25 AM(UTC)  | Reason: Not specified

stis rapidum  
#3 Posted : Friday, January 22, 2016 9:30:23 AM(UTC)
stis rapidum

Rank: Newbie

Groups: Registered
Joined: 1/17/2016(UTC)
Posts: 5
Russian Federation
Location: Moscow

Thanks a lot, it worked well!


And I want to ask another question.

Can I get what exactly was picked in a restriction? And is there a way to return the number of picked values?
epf  
#4 Posted : Friday, January 22, 2016 2:41:59 PM(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)
Yes, in this context restriction.EnumValues is a List<string> containing the values selected.
You can get the first value using restriction.EnumValues[0] for example...
Number of picked values = restriction.EnumValues.Count
Users browsing this topic
Guest
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.