Database View that includes a catalog item variables and approval information

joconnor
Tera Contributor

Hello!

I am trying to create a database view to generate a report on a service catalog item with approval information.

 

I am not able to get the variable information.  Is there something I am missing>

 

Left joinOrderTableVariable prefixViewWhere clause
FALSE100tasktasu_approver_req_view 
TRUE200sc_req_itemrequ_approver_req_viewtas_sys_id=req_sys_id
TRUE300sysapproval_approverappu_approver_req_viewtas_sys_id=app_sysapproval

 

Thank you, James

3 REPLIES 3

Swapna Abburi
Mega Sage
Mega Sage

Hi @joconnor 

Database view on 'sc_req_item' table will not display the variables. You need to join 'sc_item_option' and 'sc_item_option_mtom' tables as well in DB view along with other tables.

I tried this but still can not find the variable information to set as columns.  Thoughts? 

Left join

Order

Table

Variable prefix

Where clause

FALSE

100

sc_req_item

req

 

FALSE

200

sc_item_option_mtom

own

req.sys_id = own.request_item

FALSE

300

sc_item_option

opt

own.sc_item_option = opt.sys_id

FALSE

400

sysapproval_approver

app

app.sysapproval = req.sys_id

Rakesh18081
Tera Expert

Below is how your query should be it will require joining 3 tables.

SELECT req.sys_id, req.number, opt.variable_name, opt.value
FROM sc_req_item req
LEFT JOIN sc_item_option_mtom mtom ON req.sys_id = mtom.request_item
LEFT JOIN sc_item_option opt ON mtom.sc_item_option = opt.sys_id

 

Regards

Rakesh Agarwal