Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7564023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:48:42+00:00 2026-05-30T13:48:42+00:00

I am developing an application where i used core data framework for the purpose

  • 0

I am developing an application where i used core data framework for the purpose of maintaining a database. My entity contains three attributes called: name, start time and end time of a list of applications. I am getting the correct values for name and start time attribute.
Now my problem is my end time attribute should contain the value of the next entries start time value. If anybody having any idea about this please let me know.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:48:43+00:00Added an answer on May 30, 2026 at 1:48 pm

    You can leave the endTime attribute blank until you create the next entity. In the +Create category on the entity, get the last/first object (assuming you are using ordered entities) and update the endTime with the same value used for the new startTime.

    If your objects are not ordered it could be a bit tricky since all the entities are in a set. But if ordered, you are good since NSOrderedSet responds to lastObject (and firstObject).

    Enjoy,

    Damien

    EDIT: Here is an example factory method that either 1) returns the existing stock entity for a stock symbol or 2) creates a new entity for that symbol. Pretty easily modified to get entities and select the first/last depending on your sort order. Again see the Core Data classes from Prof. Hegarty.

     + (Stock *)stockForSymbol:(NSString *)symbol inManagedObjectContext:(NSManagedObjectContext *)context {
      Stock *stock = nil;
    
      NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Stock"];
      request.predicate = [NSPredicate predicateWithFormat:@"symbol = %@",symbol];
      NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"symbol" ascending:YES];
      request.sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
    
      NSError *error = nil;
      NSArray *matches = [context executeFetchRequest:request error:&error];
    
      if (!matches || [matches count] > 1) {
          // handle error
      } else if ([matches count] == 0) {
          stock = [NSEntityDescription insertNewObjectForEntityForName:@"Stock" inManagedObjectContext:context];
          stock.symbol = symbol;
          stock.strategyPosition = [NSNumber numberWithInt:StrategyPositionFlat];
          stock.userPosition = stock.strategyPosition;
          stock.userOwns = [NSNumber numberWithBool:NO];
      } else {
          stock = [matches lastObject];
      }
      return stock;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing Iphone application. I have used SecKeyGeneratePair method of Security/Security.h framework. I
I have used Netbeans 7.0 for developing Blackberry application with LWUIT framework. And I'm
I am developing an application using Zend Framework 1.11.10. I have used this article
I am developing a scientific application used to perform physical simulations. The algorithms used
I am developing an application which could be used in small networks where the
I am developing an application using MVC Preview 5. I have used typed views.
We are developing a SaaS application in Asp.net, where we have used the Single
The application my team is currently developing has a DLL that is used to
I'm currently involved with developing a C# CMS-like web application which will be used
I am developing an application that will be primarily used by English and Spanish

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.