0
I just need to get an attribute from a single row of the table:
name | id | idade | aprov|repro| sala |
_______|______|________|______|_____|______|
John | 32 | 15 | A | | 155 |
Following the table above would be the field idade
containing the element 15
.
How can I do this using Core Data?
In case this app is for iOS.
But this way he will bring me a whole column, in the case of a Nsarray, now that I have looked at it, and rethought it, I need him to bring me specifically a LINE and a COLUMN, to bring only a single element. Got it?
– Tiago Amaral
Okay, so I added this implementation in my reply.
– Paulo Rodrigues
Thanks buddy, I’ll test and I’ll get back to you whether it worked or not!
– Tiago Amaral
worked, but the information I wanted to pick up is not accessible, because I wanted to access the Primary Key generated by core data, in case it appears in the table as Z_PK. Gave an error saying that it is not available in the table I am using :/
– Tiago Amaral
The attribute
Z_PK
is not just any field that you use in Core Data. You do not depend on this value to maintain the consistency of your base, even because the schema can and will change with each update of your application, which is why this value is not accessible. What is the need to get it?– Paulo Rodrigues
My app has 2 tables, and one of them will only have a record, ie a Z_PK only of value 1. Which will be the user record, and the app to fill the second table, will need the user data that are in the first. Got it?
– Tiago Amaral
But of all user items, the most used will be the ID_REGISTRO field of line 1 in the case
– Tiago Amaral
Understand that the attribute
Z_PK
is of internal use of Core Data, so much so that you didn’t raise him in Xcode, you can only see it if you extract the bank Sqlite of your app. So the relationship the way you’re looking to do with this attribute has to be rethought.– Paulo Rodrigues
Yes I already rethought: The user registration will only happen once, so I will only have 1 record. So when I make the request I will only have one record for Nsarray, so it’s only what I want rs :D
– Tiago Amaral