Seal Report Forum
»
Report Edition
»
Reports
»
Enum List with UserId Restriction
Rank: Member
Groups: Registered
Joined: 2/19/2021(UTC) Posts: 10 Thanks: 2 times
|
Hey Eric,
How to filter Enum List with Logged In UserId?
Thanks, Sekhar G
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
To do that, you have to write some C# to refresh your enum list in the 'Report Execution Init Script' The script may look like: Code:@{
Report report = Model;
ReportExecutionLog log = report;
if (report.SecurityContext != null) {
var myEnum = report.Sources.First(i => i.Name=="A source name").MetaData.Enums.First(i => i.Name == "A enum name");
myEnum.Values.Clear();
if (report.SecurityContext.Name == "A name" || report.SecurityContext.BelongsToGroup("aGroup")) {
myEnum.Values.Add(new MetaEV() {Id="1", Val = "1 Val"});
myEnum.Values.Add(new MetaEV() {Id="2", Val = "2 Val"});
}
}
}
Edited by user Tuesday, February 15, 2022 6:11:57 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Registered
Joined: 2/19/2021(UTC) Posts: 10 Thanks: 2 times
|
For Enum i need to pass this param as like this,
so please advice
select id,name from vw_Sales where UserId= <LoggedinUserId>
|
|
|
|
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 can do that like this: Code: //Or change the SQL
anEnum.Sql = $"select id, name from aTable where aColumn = {Helper.QuoteSingle(report.SecurityContext.Name)}";
anEnum.RefreshEnum();
Edited by user Thursday, February 17, 2022 8:00:49 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Registered
Joined: 2/19/2021(UTC) Posts: 10 Thanks: 2 times
|
How can i add one more parameter for SecurityContext -> UserId i want to give role based access for all reports as common parameter ? with UserId in Enums Edited by user Saturday, January 21, 2023 3:00:42 PM(UTC)
| Reason: Not specified
|
|
|
|
Seal Report Forum
»
Report Edition
»
Reports
»
Enum List with UserId Restriction
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.