Functional a multi-condition query

Hi, Masters:

  I have a litter bit complex qSql, for example:

select CntCOMP:count IND, avg Grade, COMP by IND, OptDate from (IND xasc select RIC, COMP:link.COMPANY, BuySell, OptDate, OptPrice, Grade, Comment, IND:link.IND, LOC:link.LOC from AShare_Position where OptDate within ((month$2022.04.30), 2022.04.30), StrategyID = $"MTH002") where IND = $“??”

 It works fine. Then, I need embed it into a function and execute it with flying parameters. So I defined:

theDateIWant: 2022.04.30
stgid: $"MTH002"_ _ind\_name: $“??”

and parse it:

parse “select CntCOMP:count IND, avg Grade, COMP by IND, OptDate from (IND xasc select RIC, COMP:link.COMPANY, BuySell, OptDate, OptPrice, Grade, Comment, IND:link.IND, LOC:link.LOC from AShare_Position where OptDate within ((month$theDateIWant), theDateIWant), StrategyID =stgid) where IND = ind_name”

Output is:

?
(k){$[$[#x;~s=-2!(0!.Q.v y)x;0];.Q.ft[@[;*x;s#]].Q.ord[<:;x]y;y]};,IND;(?;AShare_Position;,((within;OptDate;(,;($;,month;theDateIWant );theDateIWant));(=;StrategyID;,stgid));0b;RICCOMPBuySellOptDateOptPriceGradeCommentINDLOC!RIClink.COMPANYBuySellOptDateOpt
PriceGradeCommentlink.INDlink.LOC))
,(=;IND;,ind_name)
INDOptDate!INDOptDate
CntCOMPGradeCOMP!((#:;IND);(avg;Grade);COMP)

But it always has error once I execute it with functional query, one of my ill-samples is:

IND xasc eval(?;AShare_Position;,((within;OptDate;(,;($;,month;theDateIWant);theDateIWant));(=;StrategyID;stgid));0b;RICCOMPBuySellOptDateOptPriceGradeCommentINDLOC!RIClink.COMPANYBuySellOptDateOptPriceGradeCommentlink.INDlink.LOC)) , (=;IND;ind_name)INDOptDate!INDOptDateCntCOMPGradeCOMP!((#:;IND);(avg;Grade);COMP)

It looks like the “,” is not right. I used to met this issue with single condition query, it can be resolved to replace “,” with “enlist”. But this time, “enlist” or even double “enlist” to replace “,” doesn’t work.

So, dear masters, do you know how to debug it? Appreciate for any advice, thanks!