Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have successfully connected to my client's app using the QIX Engine API using server-side websockets. I have also successfully queried all of their table fields and table data. This is great for a one time initial data load but I want to, on a daily basis, get all of the new data. In the table there is a $numeric $timestamp field. I would like to use something like `GetTableData` where $timestamp field is greater than yesterday.
How do I do this?
The `GetTableData`method is primarily intended to create previews of data and is used for instance in the "Preview" section of the data model viewer. It's not really intended for the type of data extraction you are asking for here and does not support filtering.
What you need to do is to create a hypercube and extract the data that way. You can either do the filtering by selecting the dates you want to, then extract the data using `GetHyperCubeData`, or you can use a calculated dimension and do the filtering that way. If you go with the latter approach, then you could use an expression like this to get a column based on a table column called "Timestamp" that is null for all values that are older than 1 day:
=if(Timestamp > Now()-1, Timestamp)
If you add that dimension to a hypercube, then choose to exclude null values, then you got what you're looking for. If you want to have all values since midnight yesterday, then you could just add the `floor`function around `Now` like this:
=if(Timestamp > floor(Now())-1, Timestamp)
An introduction to hypercubes in the engine API can be found here:
@rwunderlich Do you have any advice?
The `GetTableData`method is primarily intended to create previews of data and is used for instance in the "Preview" section of the data model viewer. It's not really intended for the type of data extraction you are asking for here and does not support filtering.
What you need to do is to create a hypercube and extract the data that way. You can either do the filtering by selecting the dates you want to, then extract the data using `GetHyperCubeData`, or you can use a calculated dimension and do the filtering that way. If you go with the latter approach, then you could use an expression like this to get a column based on a table column called "Timestamp" that is null for all values that are older than 1 day:
=if(Timestamp > Now()-1, Timestamp)
If you add that dimension to a hypercube, then choose to exclude null values, then you got what you're looking for. If you want to have all values since midnight yesterday, then you could just add the `floor`function around `Now` like this:
=if(Timestamp > floor(Now())-1, Timestamp)
An introduction to hypercubes in the engine API can be found here:
Thank you for the link to some explanatory documentation. I was having trouble figuring out how to do that with the reference docs.
I currently was able to do a work around by creating a session app with a custom load script that had the filters applied. Would you recommend one way over another?
Modifying the script and reloading the app should definitely give you the result you are looking for, but that's quite an expensive way to do it, at least if the app is large. But just how expensive totally depends on your app, so if that solution works for you, then I'd say its just fine!