在雅虎!管道如何从使用每个项目的值构建的循环中返回单个值?
例如,我有一个项目列表,每个项目都有一个名称。我想构建一个包含所有名称的逗号分隔列表的单个字符串。在大多数编程语言中,我会循环遍历项目并附加到列表/数组之外的值。但是,我无法弄清楚雅虎的任何组合!通过管道模块来执行此操作。也许我错过了一些明显的东西,但我也从谷歌中找不到任何相关的东西。
如何将循环项值附加到循环外的单个值?
或者如何从使用每个项目的值构建的循环中返回单个值?
或者如果这两者都不是,那么在 Pipes 中完成此操作的正确方法是什么?
For example, I have a list of items and each item has a name. I want to build a single string that contains a comma-separated list of all the names. In most programming languages, I would loop over the items and append to a value outside the list/array. But, I can't figure out any combination of Yahoo! Pipes modules to do it. Maybe I'm missing something obvious, but I also find nothing relevant from Google.
How do I append loop item values to a single value outside the loop?
Or how can I return a single value from a loop that's built with values from every item?
Or what is the correct method to accomplish this in Pipes if it's neither of those?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 Yahoo! 的帮助下想出了最好的方法。组,是使用项目生成器(item.string = default)-->循环(将所有内容分配给 item.string )。在循环内使用另一个管道来提供要连接的值也非常有帮助。
The best method I've come up with based on help from the Yahoo! group, is to use an Item Builder (item.string = default) --> Loop ( assign all to item.string ). Using another pipe inside the Loop to provide the values to concatenate was also very helpful.
不幸的是,仅 Yahoo Pipes 提供的模块无法执行您想要的任务。当前唯一可用的解决方案是使用“Web 服务”模块调用外部托管脚本(例如 PHP)...整个管道内容将作为 POST 字段“数据”发送到脚本。您可以对脚本进行编码,使其循环遍历所有项目,以将字符串添加到单个字符串并在处理后返回它。
Unfortunately the modules available with Yahoo Pipes alone cannot perform the task you are aiming at. The only solution available currently is to use "web service" module to call an externally hosted script (say in PHP)... the entire pipe content will be sent to the script as POST field "data". You can code the script such that it loops through all items to add the string to a single string and return it after processing.