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
sanyami  
#1 Posted : Tuesday, April 24, 2018 8:13:14 AM(UTC)
sanyami

Rank: Newbie

Groups: Registered
Joined: 11/20/2017(UTC)
Posts: 11
India

Thanks: 1 times
I have two table and both tables have one same column(Year).
I added table1 year column in restriction part it is filtering only table1 data not affect table2 so I added join of table1 and table2 year column then it is giving me multiple records with wrong data.
I want to add only one restriction for a year and it'll applicable for both tables.
So how to add it?

Edited by user Tuesday, April 24, 2018 8:14:59 AM(UTC)  | Reason: Not specified

epf  
#2 Posted : Monday, April 30, 2018 2:28:48 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)
Good question,
If the Year column is used in several tables, you might consider to modify your data source to create a reference table having the Years wanted...then you define a join with this reference table and you use only one restriction coming from this table.

Another lighter option is to copy the value of one source restriction to the other restriction.
This can be done in the 'Pre Load Script' of your second models.

I made a quick try with a report having 2 models:
Model Quantity -> Prompt for a quantity
Model Discount -> Restriction on discount (with no prompt)

then in the Mdl Discount, I just set the 'Pre Load Script' to
Code:
@using Seal.Model
@using System.Data
@{
    ReportModel model = Model;
	var modelSource = model.Report.Models.FirstOrDefault(i => i.Name == "Model Quantity");
	if (modelSource != null) {
		model.GetRestrictionByName("Discount").Value1 = modelSource.GetRestrictionByName("Quantity").Value1;
	}
}


The report prompt only for the Quantity, but at execution, it copies the value to the Discount restriction...
I hope it helps.
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.