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
Ott  
#1 Posted : Tuesday, July 11, 2017 2:04:14 PM(UTC)
Ott

Rank: Member

Groups: Registered
Joined: 6/9/2017(UTC)
Posts: 29
Canada

Thanks: 1 times
Hi,

Is there a way to always get a regular 'select' statement when creating a report instead of getting a 'select distinct'? I know that the select statement can be edited to remove the 'distinct' clause, but since my users would very seldom use this clause, I would prefer to default the select statement to be a regular select.

Thanks
epf  
#2 Posted : Tuesday, July 11, 2017 2:31:51 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)
You could use the 'Init Script' defined in the Server Manager, Menu Configuration->Configure Server...

In this script you could change the SqlSelect property of your models (SqlSelect).
Code:
		
foreach (var item in report.Models) {
  item.SqlSelect = "SELECT";
}

The script is applied just before the report execution.

Note that if there is an aggregate (Elements in DATA), the distinct is done by the database engine anyway.
Ott  
#3 Posted : Tuesday, July 11, 2017 2:39:16 PM(UTC)
Ott

Rank: Member

Groups: Registered
Joined: 6/9/2017(UTC)
Posts: 29
Canada

Thanks: 1 times
I don't necessarily want to force all reports to use a regular select, I just want the default to be a regular select when a report is created. Is there a way to accomplish this?

epf  
#4 Posted : Tuesday, July 11, 2017 3:13:40 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)
No, but it could be a feature request:
Having a script applied at the report creation...so all default could be set.

Ott  
#5 Posted : Tuesday, July 11, 2017 3:37:55 PM(UTC)
Ott

Rank: Member

Groups: Registered
Joined: 6/9/2017(UTC)
Posts: 29
Canada

Thanks: 1 times
Actually, when an aggregate is used, the 'distinct' clause is not added by the database (not by Oracle anyway) and if it was, it wouldn't do anything anyway. A 'group by' is required, which is added by Seal Report.

Is there a reason why the distinct clause is always added? I can't think of any reason why it would always be specified.
epf  
#6 Posted : Tuesday, July 11, 2017 3:55:28 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)
Well, for normal list without aggregate, the end-user would not expect to have duplicate lines... but this default behavior is subjective I agree.
It cannot be changed anyway for backward compatibility.
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.