QlikSense中有两个连接API,分别称为URL1(问题数据)和URL2(工作日志)。从URL1获取工作日志记录是有限制的,只有20条记录,分页没有分发,因此您必须从URL2加载工作日志。
如何执行以下操作:
从URL1加载数据时,脚本将分析[worklog]部分中“ total”字段的值,如果该值大于20,则来自字段[__KEY_fields]的键将采用相应的值[worklogs]部分中的[self_u4]字段并将其作为URL2传递给它,以加载数据。然后,该控件将从URL1返回到“ total“> 20之后的下一条记录,继续加载并分析数据。
RestConnectorMasterTable:
SQL SELECT
"expand" AS "expand_u0",
"startAt" AS "startAt_u0",
"maxResults" AS "maxResults_u0",
"total" AS "total_u0",
"__KEY_root",
(SELECT
"expand",
"id" AS "id_u5",
………………….
(SELECT
"startAt",
"maxResults",
"total",
"__KEY_worklog",
"__FK_worklog",
(SELECT
"self" AS "self_u4",
"comment",
……………………
FROM "worklogs" PK "__KEY_worklogs" FK "__FK_worklogs")
FROM "worklog" PK "__KEY_worklog" FK "__FK_worklog"),
……………….
[issuetype]:
LOAD [self] AS [self],
[id] AS [id],
[description] AS [description],
[iconUrl] AS [iconUrl],
……………………………………
[worklogs]:
LOAD [self_u4] AS [self_u4],
[comment] AS [comment],
…………………
[issueId] AS [issueId],
[__KEY_worklogs] AS [__KEY_worklogs],
[__FK_worklogs] AS [__KEY_worklog]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_worklogs]);
[worklog]:
LOAD [startAt] AS [startAt],
[maxResults] AS [maxResults],
[total] AS [total],
[__KEY_worklog] AS [__KEY_worklog],
[__FK_worklog] AS [__KEY_fields]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_worklog]);