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
ctrazzi  
#1 Posted : Tuesday, September 19, 2023 9:49:55 AM(UTC)
ctrazzi

Rank: Member

Groups: Registered
Joined: 7/14/2023(UTC)
Posts: 25
Man
Italy
Location: Torino

Thanks: 8 times
Hello.
I need to create a custom enumerate list in order to "merge" all the record that are referred to a precise user.
To be more clear:

In my database I have the table user, in this table I have:
[dbo.User]
[1][USER 1]
[2][USER 2]
[3][USER 3]
[4][USER 1 WEB]
[5][USER 4]
[6][USER 5]
[7][WEB 5 USER]

I wish to create an enumerated list in a way that [USER 1] and [USER 1 WEB] will be considered as the same inside the list and il will be dispay in the filter as [USER 1]. The same for [USER 5] and [WEB 5 USER]. I think that using MSSQL Function can be a way, but I can not understand how to apply them inside seal report.
Initialy I was thinking to use MSSQL replace function, but in the cases like [USER 5] and [WEB 5 USER] I will get to field because the 5 is before USER.

There are maybe other ways or suggestions?
epf  
#2 Posted : Wednesday, September 20, 2023 4:32:47 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)
there are several way to get a table like this:
select distinct user
from (
select case user
when 'USER 1 WEB' then 'USER 1'
when 'WEB 5 USER' then 'USER 5'
else user
end user
from dbo.user
) a

it is more a SQL question...
thanks 1 user thanked epf for this useful post.
ctrazzi on 9/21/2023(UTC)
ctrazzi  
#3 Posted : Thursday, September 21, 2023 8:53:08 AM(UTC)
ctrazzi

Rank: Member

Groups: Registered
Joined: 7/14/2023(UTC)
Posts: 25
Man
Italy
Location: Torino

Thanks: 8 times
This can be a solution thanks :)
But I am searching for something more generic...
If I do as you suggest, I have to manually fill the:

select case user
when 'USER 1 WEB' then 'USER 1'
when 'WEB 5 USER' then 'USER 5'

in any list, because the user are not always the same, and are not called:
USER 1
USER 2,
USER 3
ecc...

But are called as:
name1 surname1
name1 surname1 web
web surname2 name2
ecc...

Plus is possible that someday a new user will be inserted, and I wish to not manually modify all the enumerated list query.

To be more precise on what I wish to accomplish, I wish to create a function that can be called inside the enumerate list definition and can manage this cases.
Now I do not want you to give me the code, but I need to understand if is possible to create a global function to do this...

Thanks in advance.
ctrazzi  
#4 Posted : Friday, October 6, 2023 8:47:49 AM(UTC)
ctrazzi

Rank: Member

Groups: Registered
Joined: 7/14/2023(UTC)
Posts: 25
Man
Italy
Location: Torino

Thanks: 8 times
Hi any news about my problem?
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.