HiâŚ
I am using query like below :
SELECT meta(ch).id as uid,
ch.approvedBy,
ch.approvedDate,
ch.createdBy,
ch.createdDate,
ch.earlyAdoptionDelete,
ch.earlyAdoptionFlag,
ch.earlyAdoptionTag,
ch.indent,
ch.isDeleted,
ch.lineItemID,
ch.metadata,
ch.publishDate,
ch.publishedBy,
ch.referenceJson,
ch.smefinallanguage,
ch.standardid,
ch.status,
ch.submittedBy,
ch.submittedDate,
ch.type,
ch.version,
ch.versionHistory,
ch.updateDescriptionId,
ARRAY i FOR i IN ud WHEN ch.updateDescriptionId = i.id END AS updateDescriptionDetails,
First v.val FOR v IN ud1 WHEN ch.earlyAdoptionTag = v.name END AS earlyAdoptionTagDetails
FROM ChecklistLibrary
AS ch
LET
ud = ARRAY_FLATTEN((SELECT RAW chl.updateDescriptions FROM ChecklistLibrary
chl USE KEYS [âFor Profit:updateDescriptionâ]),2)
,ud1 = ARRAY_FLATTEN((SELECT RAW OBJECT_PAIRS(chl1.eAstandards) FROM ChecklistLibrary AS chl1 USE KEYS [âFor Profit:eAStandardsâ]),2)
,draftLineItemData= (SELECT chd.earlyAdoptionFlag,
chd.metadata,
chd.lineItemID,
chd.indent,
chd.publishDate,
chd.approvedBy,
chd.standardid,
chd.type,
chd.submittedDate,
chd.smefinallanguage,
chd.version,
chd.earlyAdoptionTag,
chd.updateDescriptionId,
chd.approvedDate,
chd.createdDate,
chd.isDeleted,
chd.position,
chd.status,
ARRAY i FOR i IN ud2 WHEN chd.updateDescriptionId = i.id END as updateDescriptionDetails
FROM ChecklistLibrary
AS ch1 unnest ch1.draftLineItemData chd
LET
ud2 = ARRAY_FLATTEN((SELECT RAW chl.updateDescriptions FROM ChecklistLibrary
chl
USE KEYS [âFor Profit:updateDescriptionâ]),2)
where meta(ch1).id like âFor Profit:1â)
where meta(ch).id like âFor Profit:1â
But it is giving the below error-
[
{
âcodeâ: 5010,
âmsgâ: âError evaluating LET. - cause: FROM in correlated subquery must have USE KEYS clause: FROM ChecklistLibrary.â
}
]
Could you tell where I need to add use keys clause.