Save NSArray into Core Data object

How do I go about saving an array in a core data store?

I'm not proficient, but you have to make a core data model in the interface for that which is like making an xml file, but with fields (very easy), and then you have to make a number of objects that handle the memory of the variables. It's something like one object for a persistent store, and then one object that mangages the persistent store and then a persistent store object or something. It's actually very clear if you read up on it in the documentation under Core Data or Persistant Store.

Similar Messages

  • Import Xml data into Core Data

    Hi im very new here, im trying to find a tutorial to import a xml data into a core data and so i can publish it in a tableview
    Can somebody help me??
    thanks

    Hi,
             If you have already have the xml data then you need to parse the XML data (Using NSXMLParser Class), After parsing the data we need to maintain arrays to store this XML content. After getting the arrays with fully parsed data, you have to store this data in our Local Database (Core Data).  May be it helps for you.
    http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation /Classes/NSXMLParser_Class/Reference/Reference.html

  • How to move multiple decision tables values into results data object

    Hi Carsten and other experts,
    I am building a BRF+ function and have a question, I would probably try to give an example to better explain the issue.
    1. Function Signature
    Context elements:  C1, C2, C3
    2. Ruleset has two decision tables DT1 and DT2.
    DT1 take C1, C2, C3 as inputs to provide C4 and C5.
    DT2 takes C5 takes as inputs to provide C6.
    What should be results data object for function to get C4,C5 and C6 as Function Output parameters?
    I have tried different combination of structures and table and couldn't figure out how it behaves.
    Thank you
    Kris

    The function gets a result structure with components C4, C5, C6.
    In a ruleset assigned to the function you have a rules that calls the two decision tables DT1/2.
    Create a structure for DT1 with C4 and C5 as components. Make the structure the result of your decision table.
    DT2 has C6 as a result.

  • One PSA request is loaded many time into master data object

    Hi All,
    We are loading attribute master data into an infoobject. There is one PSA request. But the DTP is loading multiple data requests for each data packet. Usually all data packets loads in a single request but today it created each data packet into a request and created almost 72 requests. Usually we have 2 datapackets in one request.Can any body help me with the reason?
    Thanks for your response.
    Regards,
    Baladitya

    Hi,
    It sounds like the DTP settings for your master data loading has changed. Please check if in the DTP settings the "Get All New Data Request by Request" indicator has been set along with the "Retrieve Until No More New Data" indicator. If so, it explains the behaviour that you are reporting.
    Hope this helps.

  • Edit and save a Core Data entity?

    Sorry if this is a fairly obvious issue, but I honestly can't find anything..
    Every sample Core Data application I've come across has examples of inserting and deleting entities/objects. But I cannot find anything about editing and saving some attributes of an existing object. Is this possible??
    I'm using default core data/managed objects, not custom classes yet. I can insert, view, and delete objects from the context. But I want to be able to edit attributes, and NOT in a table cell. I want to open the object in a separate window (which I can do), edit the attributes in that window, and click a "Save" button to update the attributes of that particular object. I can't find anything that shows me how.
    I am thinking a work-around would be to remove the existing object and just create a new object with the data, but if I have relationships to other objects, it seems like doing that would mess them up. My other train of thought is, if I can't do this with default core data objects, what CAN I do it with? Do I need to create custom classes for the objects, or do I need to use an SQL database separately?
    Thanks...

    Apple has this to say about that...
    Entity-relationship modeling is a way to describe data structures that can be mapped to an object-oriented system. Since it comes from the database world, there is some terminology that is associated with it that you may not be familiar with. These terms are:
    Entities, specific pieces of information in a data model.
    Attributes, the components of an entity. These are usually simple scalar types, such as int, float, or double; C structures such as char *, NSPoint; or an instance of a primitive class, such as NSString, or NSNumber.
    Relationships, references that an entity can have to other entities. These relationships can be optional or required as well as one-to-one or one-to-many.
    Properties, a collective term for attributes and relationships.
    -=-
    Entities and Managed Objects
    Each entity definition in a managed object model requires the name of the entity and the name of the class used at runtime to represent that entity.
    http://developer.apple.com/macosx/coredata.html
    do I need to use an SQL database separately?
    Core Data support three different kinds of data store formats to save managed objects contexts to. These formats are:
    • XML file format
    • Binary archive file format
    • SQLite database file format
    ...which are you using now? That is a rhetorical question for you to ponder, actually.

  • Problem with initial download of a data object

    Dear All,
    I have created a data object named "EQUIPMENT", which has three nodes. EQUIPMENT is the header node, DETAILS is the child node to EQUIPMENT and LOCATION is the child node to DETAILS. I have also done explicit key mapping to DETAILS and LOCATION.
    I have selected the following as the BE Keys in the nodes.
    SERIAL NO in EQUIPMENT header node.
    TYPE in DETAILS node.
    ZIPCODE in LOCATION node.
    In the explicit key mapping of DETAILS node we have selected "SERIAL NO" field in this node.
    In the explicit key mapping of LOCATION node we have selected "SERIAL NO" and "TYPE" fields in this node.
    Data object contains no errors and i have activated the data object and it was successful.
    Then i have also created back adapter which has EQUIPMENT get list and get detail. Get list returns only serial numbers (which is the BE key in EQUIPMENT node). Get detail takes "serail no" as input, returns "DETAILS" and "LOCATION" data in tables parameter. I have tested the get list and get detail interfaces, they are working fine. Then i have activated back end adapter and that was successful.
    Now i have triggered an initial download for the  "EQUIPMENT" data object, but there is no data downloaded into the data object. I have checked the monitoring in administration portal, it is showing status "Ended with errors", but there is no details of an error.
    So can you please let me know what could be mistake i have done or how to check what is the error. Please help us to resolve the issue.
    Regards,
    Kiran.

    Hi Kiran
    Are you checking in the NWMA>>Monitoring>>Logs and Traces>>Backend Integration?  The logs should have the proper error.
    If not can you regenerate the DO, edit and activate your adapter and try again?
    Regards
    Rohith

  • How To Add Days into a Date from java.util.Date class

    I have a problem when i wants to add 2 or days into a
    date object geting by java.util.Date class. so please help me resolve this issue?
    for e.g i have a date object having 30/06/2001,
    by adding 2 days i want 02/07/2001 date object ?
    Code
    public class test2
    public static void main(String args[])
    java.util.Date postDate = new java.util.Date();
    myNewDate = postDate /* ?*/;
    Here i want to add 2 date into postDate

    Use Calendar...
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    cal.add(Calendar.DAY, 2); // I'm not sure about that "DAY"

  • Why is data object completely emptied by XSLT on Output Data Association?

    I have an activity in a BPM 11g workflow that invokes a DbAdapter that does a Select, which may not return any rows in the normal course of processing.  My Data Associations for the Output uses an XSLT to map the returned values into one of my process data objects, accounting for the fact they could be empty because no row was found.
    The problem: While I only mapped one column from the results of the Select into my data object using an XSLT, when no row is returned, all other values are removed from my data object.  I need those to remain intact in the data object.
    Why is that?  How can I prevent that from happening?
    More details...
    Here is a snippet of my XSLT used to grab the result of the Select into my data object.  Notice it only maps docId, does not include totalEarnings or bW2IsAttached.
    <xsl:template match="/">
      <ns1:InterfaceTable>
        <xsl:if test='/ns0:AccountingDataCollection/ns0:AccountingData/ns0:docId != ""'>
          <ns1:docId>
            <xsl:value-of select="/ns0:AccountingDataCollection/ns0:AccountingData/ns0:docId"/>
          </ns1:docId>
        </xsl:if>
      </ns1:InterfaceTable>
    </xsl:template>
    Here's my process data object contents before the DbAdapter activity runs the Select.  Notice it includes docId, totalEarnings and bW2IsAttached.
    <?xml version="1.0" encoding="UTF-8" ?><MyTestData xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/MyTestData">
       <docId>123456</docId>
       <totalEarnings>100.0</totalEarnings>
       <bW2IsAttached>false</bW2IsAttached>
    </MyTestData>
    Now after the Select runs, and no row is found (which can happen), I end up with this empty data object:
    <?xml version="1.0" encoding="UTF-8" ?><MyTestData xmlns:ns1="http://xmlns.oracle.com/bpm/bpmobject/Data/MyTestData" xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/MyTestData"/>
    I need the totalEarnings and bW2IsAttached fields to remain in the data object.  How can I do that?

    I tried using the data object as a second data source to map the values back to themselves, but that did not work for some unknown reason.  Perhaps I'll try that again.
    The only reason I'm using an XSLT is to handle the case of no row returned from the DB Select.  So if there is another way to check that, this would be fine.  How can I check using an exclusive gateway for a row returned?  I just tried to create this setup, but the data object containing the row read from the service activity is not available in the gateway for checking.  This would be the ideal solution if you could tell me how to access the data object holding the result of the Select in the gateway.  Thanks!

  • Date string to Date object

    Hi
    How would i go about parsing some date strings in DD/MM/YYYY
    format into a date objects. I am sure its an easy problem but i
    cant find a simple way to do it as most of the API's want it a
    differnt format like MM/DD/YYYY
    Thanks for any help

    Hi,
    in the actionscript 3.0 cookbook there is a class DateFormat
    described, which allows to parse strings to date objects.
    You can download the code of the dateformat.as from here .
    http://www.rightactionscript.com/ascb/
    best regards,
    kcell

  • How to create a java.util.Date object from a date String?

    How do I convert a String representation of a date in for the format dow mon dd hh:mm:ss zzz yyyy (e.g. "Mon Aug 27 17:12:59 EDT 2001") into a Date object? This you might note is the output of the Date classes toString() method. I don't want to have to parse this string. Thanks!

    Try this out
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
    String d = "19990831";
    Calendar cal = Calendar.getInstance();
    cal.setTime(sdf.parse(d));To create the SimpleDateFormat with a diffrent format check out all the possibilities here
    http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html
    Hope this helps
    Regards
    Omer

  • Question about performance (entities & data object)

    Hello:
    I know that this can be, maybe, a silly question, but I've got the doubt
    I get a local reference to a entity ( myEntityLocal ) and I'm going to get many values from it.
    For example
    myEntityLocal.getId();
    myEntityLocal getName();
    myEntityLocal.getAddr();
    etc etc
    My question is
    Would be better, in performance terms, to fill all fields into a data object myEntityData ) and retrieve them from it ?
    I mean
    myEntityData = myEntityLocal.getData() // where getData() calls getter methods on myEntityLocal
    myEntityData.getId();
    myEntityData.getName();
    myEntityData.getAddr();
    I think the result is the same because is a local reference, but I've got that doubt
    Thanks and regards

    This will be san=me if you are considering the Local interfaces.
    For remote interface(like accessing EJB from Servlets resides in diffferent Apps Server) use the DTO(data Transfer Object) patterns.
    Regards
    Sushil

  • Core data and predicate on large volume

    Hi,
    In one of my current project requirement is to view product information in perticular date range.
    Input
    No. Of products  :- P1 P2 P3 P4 P5
    No of channels....:-  C1 C2 C3 C4
    No of regions     :- R1 R2 R3 R4
    Depending on any of the above combination user can select either "Daily" "Weekly" "Monthly" "Yearly"
    for daily for Perticular date there will be (5 produtcts *4 channel*4 regions)= 80 Combinations
    Daily :-so for 5 years it will be (80*365*5=1,46, 000) records
    Montly:- for monthly for 5 years :- 12 *5 = 60 so total 4800 records.
    quarterly for quarterly for 5 years :- 4 *5 = 20 so total (20*80) =1600 records.
    That means we can calculate all daliy monthly , quarterly and yerly using daily data.
    As user can varies the selected combination of product , channels and regions and can also slect the date range.
    Looking at the search criteria , we decided to load the data into core data and then use predicate to fetch teh data.
    Calculation formula:-
    Day :- On perticular date
    Weekly :- On friday i.e. end of week
    Monthly :- 31/30 month end date
    Quarterly :- March end date , Jun end date etc.
    Yearly 31st dec date
    But my questoion is ,
    1.Can we  use Daily model to fetch also monthly , quaterly and yearly information. Memory optimization good vs response time less
    2. Sepaarte data model for Daily , Monthly and quarterly . Yearly we can calculate from quarterly . [Response time good but duplicate data]
    Could anyone plesae suggest which is the best option to model this data ?

    Does this help?

  • Sample payload to include multiple Data objects in BAM

    Hi,
    We are using BAM 12c in our project. We have a requirement to insert/update data into multiple data objects as part of an EMS [Enterprise Message Source] request. As part of the request, I have some Dimensions data and Fact data. When I submit the request to server, I need to insert dimensions data when there is no data available for the specific dimension key, otherwise update the dimension meta data. Then I need to insert Fact data in to another data object along with the reference of the dimension data.
    From the Oracle documentation, https://docs.oracle.com/middleware/1213/bam/BAMUG/bam-enterprise-message-src.htm#BAMUG10589 I found sample payload for one data object operations, under the text: Use Self-Described Payload.
    Please share a sample payload to submit it to BAM so that data will be created in multiple configured BAM data objects in one EMS request.
    Thanks in Advance.
    Satya

    Deepan:
    Thank you for the fast response, the xml file you have given below will clear all the DO rows specified in that file.
    +<?xml version="1.0" encoding="utf-8"?>+
    +<OracleBAMCommands>+
    +<Clear name="/folder/do1" />+
    +<Clear name="/folder1/do2" />+
    +</OracleBAMCommands>+
    But in an organization in long run when data objects keep on increasing. should we also keep on adding the "Clear" statement into the xml file.
    i.e. like to ask the developer to create an entry in this xml file each time he creates a data object in BAM console?
    do we have any command like
    <Clear type = "dataobject" all="1" />
    Thanks you very much in advance

  • Date objects

    I have written a function that is supposed to determine if a credit card has expired given two dates. These dates are in the Date object format. I have written these functions based on what I have read that .toString() on a date object will return the date in the format "yyyy-dd-mm." My function ignores the date because the credit card expirations should only includes months and years. Here is my code:
    public boolean isExpired(Date card, Date expiration)
                   String c = card.toString();
                   String e = expiration.toString();
                   StringTokenizer sToken = new StringTokenizer(c, "-", false);
                   int cYear = Integer.valueOf(sToken.nextToken()).intValue();
                   String day = sToken.nextToken();
                   int cMonth = Integer.valueOf(sToken.nextToken()).intValue();
                   sToken = new StringTokenizer(e, "-", false);
                   int eYear = Integer.valueOf(sToken.nextToken()).intValue();
                   day = sToken.nextToken();
                   int eMonth = Integer.valueOf(sToken.nextToken()).intValue();
                   if (eYear < cYear)
                        return false;
                   else
                        if (eYear == cYear)
                             if (eMonth < cMonth)
                                  return false;
                             else
                                  return true;
                        else
                             return true;
    I am unsure if this works and when I try to test it I run into a hang up. It seems that the current version of Java has no way to define a specific date for a Date object, making testing difficult. I have heard that there is a way to do through the Calendar class but I have no idea of how. Could someone please explain how defining values for these objects work? Thanks a lot.

    I had something much simpler but for some reason the guy I'm doing this for does not it want it to test days at all... only months and years, which is why I'm doing all this complicated stuff.
    In other words
    If we have the values:
    9/15/02 and 9/17/02... this would return true, because we're only concerned with 9/02. That's what makes it complicated.
    My main question though was how do I insert a value into a Date Object to test my function..
    In other words, how would I set Date equal to 9/17/02

  • Date objects and prepared statements

    Hi, I am trying to parse a String into a Date object with format "dd/MM/yyyy hh/mm/ss". Anyway, i have a method in a separate class which reads in a String and converts it to a formatted Date object.
    static public Date convertToDate(String t) throws ParseException {
    Date dd = new Date();
    ParsePosition p = new ParsePosition(0);
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
    //y, M, etc are retrieved as substrings of String t. I know these methods are deprecated as well
    dd.setYear(y);
    dd.setMonth(M);
    dd.setDate(d);
    dd.setHours(h);
    dd.setMinutes(m);
    dd.setSeconds(s);
    String formattedDate = formatter.format(dd);
    Date theDate = formatter.parse(formattedDate);
    return theDate;
    Anyway, I am trying to use this in an SQL statement because I am using an Access DB which has a field of Date/Time value. Is this correct to use a Date object then? I have a prepared statement -
    PreparedStatement query = connection.prepareStatement(
    "SELECT FText FROM wnioutput WHERE Id = ? AND Section = ? AND Start = " +
    "? AND Field = ?");
    //start is the Date object returned from the previous method in a separate class
    query.setInt(1, id);
    query.setInt(2, section);
    query.setDate(3, formattedStart); - with this part, i get a setDate method not found, or something
    query.setString(4, ch);
    Can anybody tell me what the problem is? I know there are Date objects of java.util and java.sql. Should i be using an sql Date object? And if so, how, and where do I do this? Thank you!

    ok, i just tried
    query.setTimestamp(3, new java.sql.Timestamp(formattedStart.getTime()));
    where formattedStart is a java.util.Date object
    and I get the following error message -
    Error occured in getting endDateAndTime: java.sql.SQLException: Exception in databaseDisplay: the error message is:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    java.lang.NullPointerException
    where endDateAndTime is
    // takes in the startDateAndTime as a formatted String (before it is converted into a Date object)
    public String getEndTime(int s, int ID, String stDateAndTime) {
    String end = null;
    gui g = new gui();
    try {
    String sql = "SELECT End FROM wnioutput WHERE Id = " + ID +
    " AND Section = " + s +
    " AND Start = '" + stDateAndTime + "' AND Field = 'Wind50m'";
    ResultSet result = g.queryDatabase(sql);
    if (result.next())
    end = result.getString("End");
    } catch (SQLException sqlex) {
    System.out.println("Error occured in getting endDateAndTime: " + sqlex.toString());
    return end;
    Although this method worked fine before. So the error is in setting the date object in the prepared statement. Anymore suggestions??

Maybe you are looking for

  • Open images as float all in windows and not as uneditable background

    I hope the Elements team read these posts occasionally, and realize how many people want to default images to open "float all in windows" instead of having to hunt through the drop down menus to do it every single time PSE is opened. I also want to b

  • Wht does my computer screen keeps going dark?

    Why does my computer screen keep going dark?

  • 6270 on o2 low Battery Warning

    Hi folks, i was wondering if you can have a low battery warning on the 6270 as i don`t seem to get one , my phone just goes down , another thing is every now and then i get a flashing message across the bottom of the screen , check info service ,anyo

  • Sent items in the Email-Client of iOS5.0x

    Under iOS4.3.5 the Mail-App. Usedom to Show under Mailboxes also the Sent-items and the Spams. Under iOS5.xx there is only my inbox. How can i configure Mail to show also Sent items and the SPAM directories?

  • Error BEA 380001 ... Not able to resolve Please help

    Hi Guys, I am getting an BEA 380001 error and the message is "Invoke JCA outbound service failed with application error" Please help me to resolve this... as i am not able to proceed further. It's urgent. Regards, Archu