Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
konidena
Creator
Creator

How to apply filter to restrict Operations monitor app objects to restrict them to hold only from one app - Json with connection

Hi Team ,

I am trying to apply a filter in the below  json sql query and it is throwing me an error. Could some one help me. 

I am passing app id to restrict the app objects to fetch from only one app.

LET vAppId='cd44ec2a-b47a-4661-b94b-9a1f4dbb19a7';
 
 
LIB CONNECT TO 'monitor_apps_REST_appobject';
  
 
 RestConnectorMasterTable:
  SQL SELECT 
      "id" AS "id_u2",
      "engineObjectId",
      "createdDate",
      "modifiedDate",
      "modifiedByUserName",
      "description",
      "objectType",
      "publishTime" AS "publishTime_u0",
      "published" AS "published_u0",
      "approved",
      "name" AS "name_u2",
      "__KEY_root",
      "id_u" as "id_uNew",
      (SELECT 
          "userId",
          "userDirectory",
          "__FK_owner"
      FROM "owner" FK "__FK_owner"),
  // (SELECT 
  // "@Value",
  // "__FK_tags"
  // FROM "tags" FK "__FK_tags" ArrayValueAlias "@Value"),
      (SELECT 
          "id" AS "id_u",
          "__KEY_app",
          "__FK_app"
      FROM "app" PK "__KEY_app" FK "__FK_app")
  FROM JSON (wrap off) "root" PK "__KEY_root"
WITH CONNECTION(QUERY "filter" "id_u == $(vAppId)")
  ;

Error message: 

The following error occurred:
HTTP protocol error 400 (Bad Request):
 
The comparison expression contains an unsupported operator: id_u == cd44ec2a-b47a-4661-b94b-9a1f4dbb19a7
 
 
Request for the Qlik community: Please help me here on how to apply a filter using the correct syntax to fetch the app objects related to only the specific app. 
Labels (1)
1 Solution

Accepted Solutions
sergeyko
Partner - Contributor III
Partner - Contributor III

Hey - Good question. I never had to apply a filter via WITH CONNECTION but seems like a valid use case.

Upon doing some research on the community, here's what worked for me:

WITH CONNECTION (QUERY "filter" "app.id eq {appId}");

Highlighted in bold are the key changes:

One is to use "eq" instead of "=" (thanks to this article https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-to-cut-a-result/td-p/1637192)

The other one is to call the app id as a nested attribute of JSON (thanks to this article https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-to-cut-a-result/td-p/1637192)

Hope it helps!

View solution in original post

1 Reply
sergeyko
Partner - Contributor III
Partner - Contributor III

Hey - Good question. I never had to apply a filter via WITH CONNECTION but seems like a valid use case.

Upon doing some research on the community, here's what worked for me:

WITH CONNECTION (QUERY "filter" "app.id eq {appId}");

Highlighted in bold are the key changes:

One is to use "eq" instead of "=" (thanks to this article https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-to-cut-a-result/td-p/1637192)

The other one is to call the app id as a nested attribute of JSON (thanks to this article https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-to-cut-a-result/td-p/1637192)

Hope it helps!