How do I limit what a $variable returns in my WHERE BY clause

BMC_Grafana Plug-In
SQL: ProstgresSQL

Hi, in our Configuration Management Database (CMDB) panels, we use $DataID variable to go after the database of choice. We have a number of databases with different names, as well as some starting with the same names such as:

BMC.ASSET.SANDBOX
BMC.ASSET
BMC.AE.ASSET
BMC.ASSET.SANDBOX.BULK

  • In my “Dataset ID “ filter, I select “BMC.ASSET”.
  • In my WHERE, I have BMC.CORE:BMC_BaseElement.DatasetId IN ($dataSetID)

Filter SQL:
remedy,{“sql”: “SELECT DISTINCT BMC.CORE.CONFIG:BMC_Dataset_.CoreDatasetId FROM BMC.CORE.CONFIG:BMC_Dataset_ where BMC.CORE.CONFIG:BMC_Dataset_.CoreDatasetId is not null LIMIT 500”}

It pulls the asset records not just from the “BMC.ASSET” table, but from all “BMC.ASSET*” tables. The query is acting as if it is a wildcard and therefore pulling also from BMC.ASSET.SANDBOX and BMC.ASSET.SANDBOX.BULK.

I would like to know how write the SQL variable so it only pulls from the selected Filtered table. In this case, BMC.ASSET.

thanks,
Azard