Seal Report Forum
»
Report Edition
»
Reports
»
Restrictions on second models don't show up?
Rank: Newbie
Groups: Registered
Joined: 2/21/2019(UTC) Posts: 3 Thanks: 1 times
|
I created two models that both had restrictions and rendered them in two tabpages in a single report. The two models were highly related to each other.Effectively,they represented the same data in different dimensions.(like one was plain data,the other one was pivoted)
The problem is that only the restriction of the first model is prompted when the reprot is executed. Furthermore,since the base data was effectively the same,it would be great if users could set restrictions only once.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
You may have 2 approach to handle this: You can create a view or table that have a common join with the 2 tables and you will set the restriction only the date if this table. By SQL joins the restrictions will be applied on your 2 models. Or you can use the Pre-Load script of one of the 2 model to set the restriction values. The script below shows how to copy the 2 dates values from one model to the other. Code:@using Seal.Model
@using System.Data
@{
ReportModel model = Model;
ReportExecutionLog log = model.Report;
List<ReportElement> elements = model.Elements;
List<ReportRestriction> restrictions = model.Restrictions;
log.LogMessage("Processing the model 'Pre Load Script'");
var modelMaster = model.Report.Models.FirstOrDefault(i => i.Name.StartsWith("positions"));
restrictions[0].Date1 = modelMaster.Restrictions[0].Date1;
restrictions[0].Date2 = modelMaster.Restrictions[0].Date2;
}
|
1 user thanked epf for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 2/21/2019(UTC) Posts: 3 Thanks: 1 times
|
Originally Posted by: epf You may have 2 approach to handle this: You can create a view or table that have a common join with the 2 tables and you will set the restriction only the date if this table. By SQL joins the restrictions will be applied on your 2 models. Or you can use the Pre-Load script of one of the 2 model to set the restriction values. The script below shows how to copy the 2 dates values from one model to the other. Code:@using Seal.Model
@using System.Data
@{
ReportModel model = Model;
ReportExecutionLog log = model.Report;
List<ReportElement> elements = model.Elements;
List<ReportRestriction> restrictions = model.Restrictions;
log.LogMessage("Processing the model 'Pre Load Script'");
var modelMaster = model.Report.Models.FirstOrDefault(i => i.Name.StartsWith("positions"));
restrictions[0].Date1 = modelMaster.Restrictions[0].Date1;
restrictions[0].Date2 = modelMaster.Restrictions[0].Date2;
}
Thank you.I've tested the sencod approach. So it's intended behavior that only the restrictions of the master model are prompted rather than me not setting things properly?
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 2/21/2019(UTC) Posts: 3 Thanks: 1 times
|
Well,I tried again.There was something strange. The restrictions on the second models won't show up has been bothering me for a long time and it did be that way when I created a report yesterday ,which led to this post.But when I added another restriction on the two models,restrictions on the second model were promoted.
|
|
|
|
Seal Report Forum
»
Report Edition
»
Reports
»
Restrictions on second models don't show up?
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.