0
Weird do as server issue
So I have the following code:
let t := this;
let rounds := switch leagueNum_calc do
case 2:
["1", "JO", "PO"]
default:
if SuperCup then
["Q", "S", "F1", "F2"]
else
["1", "2"]
end
end;
do as server
for loop1 in rounds do
if length(EventRoundAnalysis[round = loop1]) = 0 then
let newRec := (create EventRoundAnalysis);
newRec.(
Events := t;
round := loop1;
LinkID := formatJSON({
Event: t.recID
})
);
for subloop1 in ["rd", "F", "M"] do
let newERAStatRec := (create eraStats).(
EventRoundAnalysis := newRec;
level := subloop1;
LinkID := formatJSON({
EventRoundAnalysis: newRec.recID
})
);
void
end
end
end
end
The important parts are line 21 and 30. The JSON does not get created if I put the loop in a do as. If I let it run on the client side (no do as) the JSON gets created properly.
I can kind of understand that maybe the newRec might now work, but I don't understand why t doesn't work. It works to link on line 18.
Thanks for any help.
1 reply
-
Hi Fred,
Could the issue be related to your custom
recIDfield?If I remember correctly, you're using a custom number field populated by a Trigger on new record, rather than Ninox's built-in
Id?This might explain why linking the record works, while accessing
t.recIDornewRec.recIDinsidedo as serverdoesn't behave as expected, especially for newly created records.
Content aside
- 9 hrs agoLast active
- 1Replies
- 11Views
-
2
Following
