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
Sherwin  
#1 Posted : Wednesday, August 18, 2021 9:15:18 AM(UTC)
Sherwin

Rank: Newbie

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

Hi,

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

DECLARE @CompanyId UNIQUEIDENTIFIER = '${ID}'

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);

}

@Raw(sql)

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

Thanks
epf  
#2 Posted : Thursday, August 19, 2021 9:38:16 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)
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
Guest (2)
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.