Urgent :- Need help in database view . Need to join case table table with survey response table.

priyankar umesh
Tera Contributor

Need to join case table table with survey response table(asmt_metric_result) but i want to show data of only two metric type . 
please help me to define where clause 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron

I have used a where clause like this joining the asmt_metric_result table to the asmt_assessment_instance table:

aai_sys_id = amr_instance && aai_metric_type = '4c309f1c3b131300bc1e832b44efc492'

Since you have two sys_ids / metric types, there could be a limitation on the where clause capability, so if the above works for one, something like

aai_sys_id = amr_instance && (aai_metric_type = '4c309f1c3b131300bc1e832b44efc492' || aai_metric_type = '12345678...')

 may not work for two.  In this case, you can leave both out of the where clause and create a before Query Business Rule, using the Database View as the table to only show the two metric types.  Give this a shot and post the script if you get stuck.

View solution in original post

3 REPLIES 3

Brad Bowman
Kilo Patron

I have used a where clause like this joining the asmt_metric_result table to the asmt_assessment_instance table:

aai_sys_id = amr_instance && aai_metric_type = '4c309f1c3b131300bc1e832b44efc492'

Since you have two sys_ids / metric types, there could be a limitation on the where clause capability, so if the above works for one, something like

aai_sys_id = amr_instance && (aai_metric_type = '4c309f1c3b131300bc1e832b44efc492' || aai_metric_type = '12345678...')

 may not work for two.  In this case, you can leave both out of the where clause and create a before Query Business Rule, using the Database View as the table to only show the two metric types.  Give this a shot and post the script if you get stuck.

Hi Brad
Thankyou for your response. Luckily 

its working fine .I am accepting your response as solution 

AndersBGS
Tera Patron

Hi @priyankar umesh ,

 

Can't you "just" dot-walk from asmt_metric_result table to the case table instead of creating a database view, or is there some context that i'm missing?

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/