目前有一个筛选框的数据是A-B的形式,如何截取这个参数,使在数据集1里用A来传参,在数据集2里用B来传参。同时还要支持多选,一般情况下是这么写的,${if(len(参数名)=0,""," and 字段名 in ('" + 参数名+ "') ")},如何改写,或者有什么别的写法,求各位大佬解答,谢谢!
用SPLIT分割, INDEXOFARRAY(SPLIT(cs,"-"),1)取A, INDEXOFARRAY(SPLIT(cs,"-"),2)取B
${if(len(cs)=0,""," and 字段名 in ('" + INDEXOFARRAY(SPLIT(cs,"-"),1)+ "') ")}
${if(len(cs)=0,""," and 字段名 in ('" + INDEXOFARRAY(SPLIT(cs,"-"),2)+ "') ")}
${if(len(参数名)=0,""," and 字段名 in ('" + replace(INDEXOFARRAY(split(参数名,"-"),2),",","','")+ "') ")}