09 May 2025 08:42 AM
I have an usecase to access the element from an array based on the value stored in another field.
data record(a=array(1,2,3,4,5))
| fieldsAdd random = random()
| fieldsAdd random_nummer = toLong((random*100)%arraySize(a))
| fieldsAdd test = a[random_nummer]
Is this possible with dqlin the openpipeline processing step or any alternate ideas to implement this?
Solved! Go to Solution.
19 May 2025 08:25 PM
Proper function if in preparation. For now you can use this formula
data record(a=array(1,2,3,4,5))
| fieldsAdd random = random()
| fieldsAdd random_nummer = toLong((random*100)%arraySize(a))
| fieldsAdd test = arrayFirst(iCollectarray(if(iIndex()==random_nummer,a[])))