Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
pam1990
Contributor III
Contributor III

Suggested best approach to reuse SQL statements for different apps

I have a SQL statement that returns the events and tasks belonging to users in my department. 

There are different areas within the department that have events and tasks.

While the code returns all the open events and tasks, the different areas have different parameters for seeing the results and they also do not want to filter events and tasks that include other areas.

What I mean by different parameters:

Our Closing area, for example, only wants to see records related to activity category called deals and that two of the possible five or six funding types.

Our Accounting area only wants to see open tasks related activity category called loans and to their area and they do not care about the status of the funding.

They also do not want to filter events and tasks that include other areas means:

Using the above two examples, Accounting does not want to filter on records that are related to other groups and vica versa for Closing.

It does not make sense to have two load scripts when 99% of the code is the same for the above. Also, it makes it easier to only make changes once. How can I use one SQL in the load script for the 99%, but then filter down based on what I shared above?

Labels (5)
1 Reply
pam1990
Contributor III
Contributor III
Author

I think I have the answer to my own question.

I can create a qvd that covers the 99%, then create separate qvds with code that identifies the the specific group and includes their parameters.

From there I can associate the qvds.