Execute ZCQL Query
Construct the Query
You must construct a ZCQL query on the required data set before you execute it. A sample SELECT query is shown below:
copy//Create a query to execute var query = 'SELECT * FROM ShipmentData';
Execute the Query
The query object created in the step above is passed to the executeZCQLQuery() method. The zcql reference used here is the component instance defined earlier.
This will return a promise which will be resolved to an object. The content key will contain the array of row objects.
copy//Execute the query by passing it var zcql = catalyst.ZCatalystQL; var zcqlPromise = zcql.executeQuery(query); zcqlPromise .then((response) => { console.log(response.content); }) .catch((err) => { console.log(err); });
Note: To use ZCQL V2 commands in your code, use the Catalyst methods listed here with the values listed below to set the appropriate environment variable:
-
Key: ZOHO_CATALYST_ZCQL_PARSER
-
Value: V2
A sample response that you will receive is shown below. The response is the same for both versions of Web SDK.
Web SDKcopy[ { AlienCity: { CREATORID: "2136000000006003", MODIFIEDTIME: "2021-08-13 13:49:19:475", CREATEDTIME: "2021-08-13 13:49:19:475", CityName: "Dallas", ROWID: "2136000000008508" } }, { AlienCity: { CREATORID: "2136000000006003", MODIFIEDTIME: "2021-08-16 15:55:32:969", CREATEDTIME: "2021-08-16 15:55:32:969", CityName: "Houston", ROWID: "2136000000011002" } }, { AlienCity: { CREATORID: "2136000000006003", MODIFIEDTIME: "2021-08-16 17:03:01:507", CREATEDTIME: "2021-08-16 16:29:10:499", CityName: "Austin", ROWID: "2136000000011011" } } ]
Last Updated 2023-11-14 13:20:49 +0530 +0530
Yes
No
Send your feedback to us
SkipSubmit