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



Go to last post Go to first unread
#1 Posted : Wednesday, August 18, 2021 9:15:18 AM(UTC)

Rank: Newbie

Groups: Registered
Joined: 8/18/2021(UTC)
Posts: 1
South Africa
Location: Johannesburg


So I'm trying to override an existing sql query using the pre-load script feature by passing in another query with custom variables passed in through restrictions, now I'm not getting any errors but for some reason no data is being retrieved/shown in the view

1. I'm trying to replace '${ID}' with a restriction value


2. The imports being used:

@using System.Data
@using Seal.Model
@using Seal.Helpers
ReportModel model = Model;
ReportExecutionLog log = model.Report;
List<ReportElement> elements = model.Elements;
List<ReportRestriction> restrictions = model.Restrictions;

3. The code I used:

if (model.Source.Report != null)
ReportRestriction restrictionCompany = restrictions[0];
sql = sql.Replace("${ID}", restrictionCompany.Value2);



If you can see what I'm doing wrong or can advise further it would be much appreciated

#2 Posted : Thursday, August 19, 2021 9:38:16 AM(UTC)

Rank: Administration

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

Thanks: 14 times
Was thanked: 172 time(s) in 166 post(s)
it is not clear how you want to do that.
However to inject restrictions in your SQL query, you may using Input Values: https://sealreport.org/Reports#lineInputs

Another way could be the use of Common Restrictions if the restriction is part of the table definition: https://sealreport.org/S...ces.cshtml#lineTables_cr

Finally you may use tasks and scripts, but this requires C# skills.
Users browsing this topic
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.