Skip to main content

Hello everyone, πŸ‘‹

I’m building an overlay view to show case details, using number as a variable.
Currently, the overlay view has a predefined filter like this:

FILTER "sc_req_item"."number" = '${number}';

Β 

However, I’d like to make the overlay more dynamic β€” for example, use another variable ${case_table} to replace "sc_req_item" (or even "sc_req_item"."number") so that the same detail view can work for multiple case types, such as Requests, Request Items, and Tasks.

Β 

Has anyone successfully used a variable for table or column names in a FILTER statement (or found another way to make one detail page work dynamically across multiple case tables)?

Any insights or workarounds would be really appreciated! πŸ™

Β 

Thanks!

BR,

Xiangxiang

Hey there,
When dealing with filters in PQL, the core limitation is that the language is designed to use variables for values, not for structural elements like table or column names. The filter must know exactly which column it is checking. Thus, your direct substitution, like FILTER "${case_table}"."number" = '${number}', fails because PQL cannot dynamically resolve the variable case_table into a live table name at runtime. To overcome this rigidity when dealing with multiple data sources (like overlay Views across different case tables), the recommended solution is to use the CASE_TABLE() operator. This function allows you to reference the current, correct Case Table based on its relationship to the Activity Table, providing a standardized way to pull the required column (.number) regardless of the underlying data source being used. For truly complex scenarios, especially with overlay Views, the best practice is to define the filter logic for each specific case table and use variable mapping only to pass the filter's value (e.g., ${number}), ensuring precise filtering while maintaining the necessary structural definition in the PQL.
Let me know if this helps!