I have an expense tracking iOS Application using Core Data Model:
Scenario:
-> An abstract parent entity named “Money” with attributes “vendor”, “date”, “amount” and so on. The two sub-entities “Expense” and “Income” inherit from the parent entity “Money”. Then there are other entities such as “Category” and “subCategory” with their attributes. Total as of now: 5 entities (Money, Expense, Income, Category and Subcategory) in my data model.
Question: What I want to achieve is to track expenses daily, per week, bi-weekly, monthly and yearly. I am thinking to make an entity say “Months” with 12 attributes ( Jan – Dec – > month names) but isn’t that too much complicated?
Thoughts?
I have a Table-view and using NSFetchedResultsController to fill my table-view with the mix od expenses and Incomes.
You have to create an
NSFetchRequestwith anNSPredicatethat filters for the appropriate time period. Let’s say you want to list all expenses between two dates your could implement a method that returns anNSFetchRequestthat filters for this period:You could then use this fetchRequest for example in an
NSFetchedResultsControllersimilar to my answer in your other question:
CoreData and TableViews
Then all you’d have to do is create the NSDate objects for start- and endDate for your desired time period and pass them to this method.