Rank: Newbie
Groups: Registered
Joined: 1/17/2016(UTC) Posts: 5 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.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 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
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/17/2016(UTC) Posts: 5 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?
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 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
|
|
|
|
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.