SwiftData - equivalent of 'UPDATE WHERE'

I'm working on an app where I have a dataset of empty scores populated from a webserver. When created, the data has empty values for the scores, but the other fields are populated. So, each item has values for day, eventid, entrantid, score and a few more. The actual scores are recorded/added over a period of time.

If I was using a SQL-type database, I would use something like, 'UPDATE scoreTable SET score = 123 WHERE day = 1 AND eventid = 2 AND entrantid = 3'

Is this possible in SwiftData?

Yes, you can update records in SwiftData using Core Data. To do this:
Fetch the specific record: Use a fetch request with a predicate to locate the record you need.
Update the record: Modify the properties of the fetched object.
Save the changes: Commit the changes to the persistent store by saving the context.
These steps will allow you to update a record in SwiftData similarly to how you would with a SQL database.

Thanks, Mike. Yes - I understand that. What I'm trying to do is add some parameters which are stored as State or AppStorage values. If I add the Query in the View initially, I get a message stating that the Fetch can't be completed as the request is being defined before the parameter values have been returned from storage (or something along those lines - don't have my coding to hand at the moment)

I think that what I'm really asking is whether/how FetchRequests can be put inside a func and retrieved once the parameters are known - not when the view is first called. Hope that makes sense? I'm just moving over to SwiftUI/SwiftData from Swift/CoreData and haven't quite got there yet with data persistence.

Thanks again,

Hi, @oldgit. Questions about Swift Data, which is an Apple platform framework and not (despite the name) part of the open-source Swift project, should really be asked over at the Apple developer forums.