Update only some some children
Aplogise for the apparent favouritism, but I need to update the Date field of only those child records whose Date field is either in the future or simply blank/empty and not been able to figure out how to 'filter' the children at all.
Easy to do in SQL, but there appears to be no UPDATE function in Ninox.
Despite this, I have found it is very easy to update ALL the children, but could someone point out how to filter these so only the required ones are updated? Do I need to construct a loop to do this or is there a simple clever command that will accomplish this?
4 replies
-
Hi
From a parent record use this format
for a in Child[Date > today() or Date = null] do
a.(Date := NewValue)
endTo loop through all the parent records, updateing the children
for a in Parent
for b in a.Child[Date > today() or Date = null] do
b.(Date := NewValue)
endend
To update all the children directly
for a in select Child where Date > today() or Date = null do
a.(Date := NewValue)
endRegards John
-
if this is a one time action with the same data then you can use the Update Multiple Records function.
1) in your child table your would filter the dataset
2) click on the gear icon and select Update multiple records...
3) find the field you want to update then type in the value you want to set it to
You will see at the bottom of the window it says Update Visable Records, thus the filtering from line 1.
-
No, it's not a one time action, otherwise easy as you say Fred.
I want to update the children when a certain parent field is changed and although for any single parent that should just be once, it can occur for any parent.
-
John, thanks for that. It's pretty much what I had been trying but using WHERE which was getting me nowhere :-).
I had seen that a different filter construction is sometimes needed and planned to look into that today, so pleased to see your example here. Most helpful. Thanks.
Content aside
- 3 yrs agoLast active
- 4Replies
- 291Views