${IF(AND(LEN(UserName)=0,LEN(DP)=0),'',IF(AND(LEN(UserName)=0,LEN(DP)<>0)," AND DISPLAYNAME IN ("+"'"+treelayer(DP,true,"\',\'")+"'"+")",IF(AND(LEN(UserName)<>0,LEN(DP)=0)," AND USERNAME IN ("+"'"+treelayer(UserName,true,"\',\'")+"'"+")"," AND DISPLAYNAME IN ("+"'"+treelayer(DP,true,"\',\'")+"'"+") " + " AND USERNAME IN ("+"'"+treelayer(UserName,true,"\',\'")+"'"+")")))}
往里面套IF就可以实现,没找到其它办法