Converting variables into array of strings before it is a part of N1ql query


#1

For the following N1Ql query I am passing the input parameters from GraphQl payground

select _id,type,name,style,class,position,`Index`,question,marksVal,difficulty,depthofknowledge,grade,subject,topic, standard,`collection`,category, isPublicTemplate,content.`content`,createdAt,modifiedAt,security,active,references,title,subTopic from ${process.env.COUCHBASE_BUCKET} WHERE _type="question

            AND (ANY grd IN IFMISSINGORNULL("${data.grade}",[  ]) SATISFIES grd = grade END  AND
            ANY sub IN IFMISSINGORNULL("${data.subject}",[  ]) SATISFIES sub =subject END AND 
            ANY top IN IFMISSINGORNULL("${data.topic}",[  ]) SATISFIES top =topic END AND
            ANY dif IN IFMISSINGORNULL("${data.difficulty}",[  ]) SATISFIES dif=difficulty END AND
            ANY mrk IN IFMISSINGORNULL("${data.marksVal}",[  ]) SATISFIES mrk=marksVal END AND
            ANY tle IN IFMISSINGORNULL("${data.title}",[  ]) SATISFIES tle =title END AND
            ANY que IN IFMISSINGORNULL("${data.question}",[  ]) SATISFIES que =question END)

for “data.grade” data is coming to the query like
[“Grade1”, “Grade2”]

but the query is getting converted to
[“Grade1, Grade2”]

the same issue is coming for all the scenario i.e
data.subject ,data.topic, data.difficulty, data.marksVal, data.title, data.question

kindly suggest ,how to convert the array before it becomes the part of the query.It should be implemented like the following Required format.

Current format: [“Grade1, Grade2”]
Required format: [“Grade1”, “Grade2”]


#2

Did you tried "{data.subject}" as {data.subject}

If you problem persist, change category to SDK you used.