There must be a better way...
I have the following code:
let curRider := 'Team Membership'.RiderID;
let rndJmp := RiderResults.'Round Type';
let x := for loop1 in rndJmp do
AllResultRecIDs[RiderID != curRider and 'Round Type' = loop1]
end;
let y := replace(concat(x), ", ", ",");
let n := split(y, ",");
for loop2 in n do
record(Results,number(loop2))
end
So at line 3 variable "x", I'm getting the following results:
rid([[2847,2848],[2880,2882],[2898,2900]])
So I can't use the result to filter, so then I have to convert "x" into a string without the grouping. Which lead me down to path that I did.
If you do a concat(x) then you get:
2847,2848, 2880,2882, 2898,2900
So on line 6, I use the replace() command to remove the space after the comma.
Then on line 7, I convert the string back into an array.
Then find the records again.
Is there a better way without having to lose the rid in line 3?
12 replies
-
What is AllResultRecIDs ? Is this a global function?
-
I didn't know you could create a multidimensional array in Ninox. I can't assign [[2847,2848],[2880,2882],[2898,2900]] to a variable so I can't run any operations on it.
I don't know if the array() function would work or would be an improvement. Something like array(item(x,0),item(x,1)).
-
The fact that a "for" loop can magically create an array is very useful in many situations, but sometimes, as in this case, it can not give the desired result. An alternative way to produce the desired array could be something like:
let result := slice(AllResultRecIDs,0,0); for loop1 in rndJmp do result := array(result,AllResultRecIDs[RiderID != curRider and 'Round Type' = loop1]) end; result
-
I don’t have a copy of your database to fully verify this, but could not:
AllResultRecIDs[RiderID != curRider and contains(rndJmp,'Round Type')]
replace the explicit loop ?
-
This more of what is happening. See the uploaded DB and look at the field Formula in Table1.
-
, Thanks for posting your example databases.
Content aside
- Status Answered
- 1 yr agoLast active
- 12Replies
- 161Views
-
4
Following