-1

i've create an entity with library graph in my app with field name and surname, i've inserted a record perfetto Now how can i fetch from entity only one name? Thanks Umberto

1 Answers1

0

Your question is not so clear. I think you want to search Graph for an Entity with a property key, is that correct? If so, here is what you would be looking for.

let graph: Graph = Graph()
let collection: Array<Entity> = graph.searchForEntity(properties: [(key: "name", value: nil)])

The collection will hold all the Entities that have the property key of name.

CosmicMind
  • 1,499
  • 1
  • 10
  • 6
  • Sorry for my english. let act = Entity(type: "Record") act["tempo"] = "09:00" act["tentativi"] = "2" act["valore"] = "decimi" I have read in an array all the data in the entity "Record" with "valore" = "decimi". is it correct let graph: Graph = Graph() let collection: Array = graph.searchForEntity(properties: [(key: "valore", value: "decimi")])? – Umberto Romano Apr 24 '16 at 14:12
  • Looks correct. This will return all Entity types with that key / value pair. Graph really works in many different ways. It is designed to work the way you think. – CosmicMind Apr 24 '16 at 18:14