UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Core Data

Forums > Swift

Right now I am able to fetch all the Words for the Entity " Location" with no problem.

But what I need is to be able todo is to fetch all words that are associated with "story_id: 149" I have only listed 3 Events for locations

var story_id = "149"

So the rule that I would need tobe able to extract all the keywords for story_id.

Location / Location.story_id / Location.keyword Thank you ahead of time for all help to my needs.

 init() {
        locations = FetchRequest<Location>(entity: Location.entity(), sortDescriptors: [NSSortDescriptor(keyPath: \Location.event, ascending: true)])
    }

Here is my relationship graph Relationship Graph:

{
         "keyword": "Boston",
         "location_id": "6282",
         "story_id": "3207",
         "event": "Canada3"
      },
       "keyword": "Boston",
         "location_id": "6282",
         "story_id": "149",
         "event": "Burbank On Parade"
      },
      {
         "keyword": "Burbank",
         "location_id": "6277",
         "story_id": "149",
         "event": "Burbank On Parade"
      },
      {
         "keyword": "Miami",
         "location_id": "6283",
         "story_id": "3213",
         "event": "Canada2"
      }

3      

Not on my computer so this might not be 100% right but I think it would be this:


locations = FetchRequest<Location>(entity: Location.entity(), sortDescriptors: [NSSortDescriptor(keyPath: \Location.event, ascending: true)], predicate: NSPredicate(format: "storyId == %@", story_id))

3      

Sorry for taking so long to reply. I am having difficulties right now todo a fetchBatch delete of my Entities. As of right now, I am able to delete one but 4 others I have not been able to succeed. May I ask if you are proficent with Core Data? If So, woud you mind to look at why I not able to? I am willing to pay you to making it work. Just forward me your PayPal account and I will transfer the money.

3      

thats ok,

if you can post as much info as you can here about what you are trying to do along with maybe some of your code then I and others can see if we can help

no one needs paying here. I'll take a look at it and if I can help then I will and if I can't because it's not something I'm experienced enough for then hopefully someone else can.

Ive got quite a lot of core data in my current app so hopefully I can help

3      

Thank you, I will do so. Right now I am working on getting somethings corrected. I will be posting here in a couple of days. THANK YOU VERY MUCH.

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.