DQL - Integer as String
I have a saved DQL query that users can run. I've been asked if we can change how the values are displayed in the query such that the column review_cycle(integer) will show 'Critical' if the value of the integer is 12, and 'Normal' if it is not equal to 12.
Using SQL this seems like a CASE statement. How can I use DQL to achieve this?
Best Answers
-
There is not equivalent in DQL. To achieve what you are wanting changes the data type returned from int to string.
There are 2 ways I can think of to do this and get the result you want:
- Build a SQL View and register that view as a registered table. Your view can do the select query and include the DB CASE function to return the string you want
- If you are using Documentum Client (D2 Classic or Smart View), you can use D2-Config's display mapping to have the client UI display alternative forms of the data.
#1 sounds like what you may want as DQL is not client specific. I used similar trick (view as a registered table) to get XML output/hierarchy of some fields. You can do a lot with views as registered tables to increase what you can deliver with DQL queries.
0 -
Assuming your custom type name is mytype where you have the integer column review_cycle , you could try DQL like below
select r_object_id, object_name, 'Critical' as review_cycle
from mytype
where
review_cycle = 12
union all
select r_object_id, object_name, 'Normal' as review_cycle
from mytype
where
review_cycle != 121
Answers
-
There is not equivalent in DQL. To achieve what you are wanting changes the data type returned from int to string.
There are 2 ways I can think of to do this and get the result you want:
- Build a SQL View and register that view as a registered table. Your view can do the select query and include the DB CASE function to return the string you want
- If you are using Documentum Client (D2 Classic or Smart View), you can use D2-Config's display mapping to have the client UI display alternative forms of the data.
#1 sounds like what you may want as DQL is not client specific. I used similar trick (view as a registered table) to get XML output/hierarchy of some fields. You can do a lot with views as registered tables to increase what you can deliver with DQL queries.
0 -
Assuming your custom type name is mytype where you have the integer column review_cycle , you could try DQL like below
select r_object_id, object_name, 'Critical' as review_cycle
from mytype
where
review_cycle = 12
union all
select r_object_id, object_name, 'Normal' as review_cycle
from mytype
where
review_cycle != 121 -
That is a great answer too @MohamedYousuff
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 150 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories