[英]In Podio-Globiflow, what is the workaround for function array_rand?
I'm trying to create a function to fetch one or more random entries from my array but I'm having an "illegal call" array_rand error on my flow. 我正在尝试创建一个函数来从我的数组中获取一个或多个随机条目,但是我的流程中出现“非法调用” array_rand错误。
Then I realized that not all PHP functions are supported through GlobiFlow, so I was hoping that there's a workaround for this one. 然后,我意识到GlobiFlow并不支持所有的PHP函数,因此我希望有一种解决方法。
screenshot: 屏幕截图:
Here are my variables: 这是我的变量:
Here's the furthest that I got: 这是我得到的最远的信息:
explode(",", choicesval)[intval(randum)]
But the problem is, it returns the element from my array based on the index. 但是问题是,它根据索引从我的数组返回了元素。 For example, my randnum got a value of 3, so in my Xfield, it will return the element at index 3 and not select 3 random items from my array.
例如,我的randnum的值为3,因此在我的Xfield中,它将返回索引为3的元素,而不从我的数组中选择3个随机项。
Hope I'm making any sense at all. 希望我有任何意义。
I'm not successful in correcting my error above, however, I've found a workaround to achieve the same result. 我无法成功纠正上述错误,但是,我找到了一种解决方法来实现相同的结果。
I created a new var named limitnum = 0, then a for each loop: 我创建了一个名为limitnum = 0的新var,然后为每个循环创建了一个:
for each item:
if limitnum <= randnum
choicesval = [(Ref Client) Company Name]. ", " .[(Variable) choicesval]
limitnum += 1;
end if
continue()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.