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

  • SEARCH
  • Home
  • 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 6961837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:34:56+00:00 2026-05-27T15:34:56+00:00

Hi I have created an array from core-data using: NSArray* invoiceItem =[fetchedResultsController fetchedObjects]; which

  • 0

Hi I have created an array from core-data using:

NSArray* invoiceItem =[fetchedResultsController fetchedObjects];

which returns the following according to the log:

"<Invoice: 0x8545900> (entity: Invoice; id: 0x8542dd0 <x-coredata://AF2BBB5C-4135-45EB-A421-5036AE02D2A0/Invoice/p19> ; 
data: {\n    GSTAmount = \"0.75\";\n    amountPaid = nil;\n    cardID = 0;\n    
customer = \"\";\n    date = \"23/12/2011\";\n    incTaxPrice = \"8.25\";\n    
incTaxTotal = \"8.25\";\n    invoiceNumber = a20;\n    itemCode = 1035;\n    
paymentMethod = nil;\n    price = \"7.50\";\n    quantity = 1;\n    saleStatus = I;\n
taxCode = GST;\n    timeStamp = \"2011-12-22 22:10:25 +0000\";\n    total = \"7.5\";\n})",

 "<Invoice: 0x8545c00> (entity: Invoice; id: 0x8543390 <x-coredata://AF2BBB5C-4135-45EB-A421-5036AE02D2A0/Invoice/p20> ; 
data: {\n    GSTAmount = \"0.55\";\n    amountPaid = nil;\n    cardID = 0;\n    
customer = \"\";\n    date = \"23/12/2011\";\n    incTaxPrice = \"6.05\";\n    
incTaxTotal = \"12.1\";\n    invoiceNumber = a20;\n    itemCode = 1040;\n    
paymentMethod = nil;\n    price = \"5.50\";\n    quantity = 2;\n    saleStatus = I;\n
taxCode = GST;\n    timeStamp = \"2011-12-22 22:11:14 +0000\";\n    total = 11;\n})"
)

My overall aim is to simply create an string of the itemCode property formatted so that it can be a column in a pdf as I do not know any other way of making a table other than creating an image of the tableview and inserting that in the PDF. I want to avoid doing that.

So instead I am trying to get a string from the above array, formatted as below

"1035\n1040"

I don’t know how to get the item code property from the array by itself. Note the Item code will vary in length and will not always be just numbers.

Any help will be appreciated!!! If anyone has any other tips or a better way to achieve what I am trying to do, i’m all ears 🙂

Edit

Purely for breadth of solutions. I happened to come up with a solution after I stepped away from the computer for a couple minutes. I’m not going with my solution as the other seems to be a bit more efficient/to the point. However I thought I would put it up for others to see another method.

NSMutableArray *itemCodes =[invoiceItem mutableArrayValueForKey:@"itemCode"];
NSString *holdingString =[NSString stringWithFormat:@"%@",itemCodes];
NSString *itemColumn = [holdingString stringByReplacingOccurrencesOfString:@"," withString:@"\n"];
  • 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-27T15:34:57+00:00Added an answer on May 27, 2026 at 3:34 pm

    First get an array of the values you want. Then join those values with a string. In your case a newline character.

    NSArray *itemCodes = [invoiceItem valueForKey:@"itemCode"];
    NSString *itemCodeString = [itemCodes componentsJoinedByString:@"\n"];
    

    You could iterate over the properties of the entity (NSEntityDescription) property of your Invoice managed object and create a dictionary of properly formatted strings keyed by each property’s name.

    If I may suggest a minor change that could make your code more readable. Instead of

    NSArray *invoiceItem;  
    

    You might consider renaming the variable to invoiceItems or results to help identify the variable as a “container” as opposed to an “instance”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Javascript array which contains User object. I have created this array from
I am creating an app which uses Core Data. I have a flip-side in
I have created an IEnumerable list of racing drivers using LINQ from a string
I have a navigation based application using Core Data and several levels of drill-down
I am fetching a set of objects from a Core Data persistent store using
i have created Array of Linkbutton and when user click on link button it
I have created an array Man: public main blah blah{ man = man[10]; }
I have an array created with this code: var widthRange = new Array(); widthRange[46]
How do I pass an array I have created on the server side onto
I have an array I've created in JavaScript. The end result comes out to

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.