Both nested query and pagination works seperately, but I struggle to get it work with both of them. I have tried the solution in the linked case below, but I get stuck on the same place as the user in that case:
The query table is running for approximately correct time (which indicates it is reading the correct amount of data), but no data is going into the SQL-table.
The query is this simple:Â
SELECT fields,formId FROM REST.Formz_DataPerForm WHERE Nested_Id IN (SELECT formId FROM REST.formz_WithDateFilter)
<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from JSON. --> <api:info title="formz_WithDateFilter" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1"> <!-- You can modify the name, type, and column size here. --> <attr name="formId" xs:type="string" readonly="false" other:xPath="/json/formId" /> <input name="rows@next" desc="Identifier for the next page of results. Do not set this value manually." /> </api:info>
<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. --> <api:script method="GET"> <api:set attr="method" value="GET"/> <api:call op="jsonproviderGet"> <api:push/> </api:call> </api:script>
<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. --> <api:script method="GET"> <api:set attr="method" value="GET"/> <api:call op="jsonproviderGet"> <api:push/> </api:call> </api:script>
</api:script>
Â
Hi ​@jarleÂ
The default pagination options do not work when you use a nested call unfortunately.
I now see you aren’t doing a nested call but a query slicer.
Do you get an message like this?
Â
Hi Thomas,
I tested nested call earlier, but couldn’t get it to work, so I tried the query slicer. I don’t get any error message, when running the query above. I just don’t get any rows.
I can test the enum method, but is there an example with enum-method and nested data somewhere? X-Total-Count is a response Header. Do you know how to reference a response Header in the xpath?
Anyway query slicer seem to be a little bit more clean option than the enum method. Do you see any specific reason why it doesn’t work? As it gets zero rows, I guess it doesn’t match correctly somehow.
Hi ​@jarleÂ
I got my files with Query Slicers to work eventually. Essentially you get the message I shared when one of the tables has an issue.
Once both tables worked it also returned a result.
You can mix the pagination in with the query slicer.
This should work.
<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!-- See Column Definitions to specify column behavior and use XPaths to extract column values from JSON. --> <api:info title="Formz_DataPerForm" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1" other:queryslicercolumn="nested_id"> <!-- You can modify the name, type, and column size here. --> <attr name="nested_id" xs:type="string" readonly="false" other:filter="{nested_id}" other:xPath="/json/nested_id"/> <attr name="formId" xs:type="string" readonly="false" other:xPath="/json/formId"/> <attr name="fields" xs:type="string" readonly="false" other:xPath="/json/fields"/> </api:info>
<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. --> <api:script method="GET"> <api:set attr="method" value="GET"/> <api:call op="jsonproviderGet"> <api:push/> </api:call> </api:script> </api:script>
You just need to pair it with a where clause that gives the list of ids needed to iterate over.
SELECT * FROM OREST].TFormz_DataPerForm] WHERE Rnested_id] IN (SELECT Cid] FROM OREST].TSourceOfId])
In the log you should see it make this call and actually show the generated SQL as
WHERE Rnested_id] IN (1,2,3,4,5)
Ok, so you have added EnablePaging and the parameters to the rsd file with detail data ( REST].]Formz_DataPerForm]).
I still get no data when doing it. When I try to query the eREST].TFormz_DataPerForm] with only one Id, I still get no data:
Â
Hi ​@jarleÂ
Is it possible for me to try it out?
Hi ​@Thomas LindÂ
Yes, Should we take a session, or should I send some keys to use with the api?
I have time for a session whenever tomorrow.
Jarle
Hi ​@jarleÂ
Both, maybe.
If you send me the files, I can try them out and possibly replicate the issue, then we can do a meeting about it depending on what I find.
Do you know my email, you can send it to me on that?
We finally got this to work by using formId (existing field) instead of nested_id (parameter).
SELECT * FROM REST.Formz_DataPerForm WHERE formId IN (SELECT formId FROM REST.formz_WithDateFilter)