Bot Framework .NET中的变量过滤器数组

发布于 2025-01-23 21:28:45 字数 683 浏览 0 评论 0原文

array2 bot当前。

想通过array1项目过滤

"changeType": "push",
"itemsProperty": "user.array2",
"value": "=where(json(user.apiResponse.content).value,x,x.myKey=='magazine')"

对于array1中的每个项目,我 基于Array1中的当前项目,这是不起作用的:

"changeType": "push",
"itemsProperty": "user.array2",
"value":"=where(json(user.apiResponse.content).value,x,x.myKey==concat('\'',json(dialog.forEachThing.value).name,'\''))

我尝试设置一个属性,用户。

"property": "user.myFilter", 
"value": "=concat('\\'',json(dialog.forEachThing.value).name,'\\'')"

虽然此user.myfilter正确评估“杂志”,但编辑数组属性/推送没有任何值。

我真的欢迎对我出错的任何想法。我在用户中尝试了一些诸如'''之类的事情。

For each item in array1, I want to filter array2 by the array1 item the bot is currently in.

Within an Edit an array property, if I filter array2 hard-coded like so it creates a nice array:

"changeType": "push",
"itemsProperty": "user.array2",
"value": "=where(json(user.apiResponse.content).value,x,x.myKey=='magazine')"

However if I use a dynamic key based on the current item in array1, this doesn't work:

"changeType": "push",
"itemsProperty": "user.array2",
"value":"=where(json(user.apiResponse.content).value,x,x.myKey==concat('\'',json(dialog.forEachThing.value).name,'\''))

I've tried setting a property, user.myFilter and passing that, as below.

"property": "user.myFilter", 
"value": "=concat('\\'',json(dialog.forEachThing.value).name,'\\'')"

And while this user.myFilter evaluates correctly to 'magazine', the Edit an array property/push doesn't get any values.

I'd really welcome any thoughts on where I'm going wrong. I've tried a few things like '''' in user.myFilter but these evaluate as null.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清晨说晚安 2025-01-30 21:28:46

好的,在此处为关注者更新答案。

原来我错了。无论如何,在.net中,解决方案是简单地不将变量包装在单个引号中。感谢Dana V在Github的头脑中抬起头来。

但是,似乎在JavaScript中可能不起作用。

Ok, updated answer here for those who follow.

Turns out I was wrong. In .Net anyway, the solution is to simply not wrap the variable in single quotes. Thanks to Dana V in github for the heads up.

It seems that may not work in Javascript however.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文