Hello
I'm new to Sensible Cocoa but find it already now very powerful. I managed to make my first project with three tables and their relationships without problems, however I bumped into a problem which I tried to solve but can't find any solution.
Assumption: I have two tables: recipe and Aroma (ingredient) which are related with 1:Many.
Problem:
I manage to add multiple aroma (ingredients) to my recipe (with SCPropertyTypeArrayOfObjects and SCArrayOfObjectsAttributes), but always need to re-enter my ingredients separately rather than to be able and choose from already existing ones.
//Create Recipe Definition SCEntityDefinition *recipeDef = [SCEntityDefinition definitionWithEntityName:@"Recipes" managedObjectContext:context propertyNamesString:@"Recipe:(name,desc,pg,vg,h2o); Aroma:(r2a); Category: (r2c)"];
//Create the Aroma Definition SCEntityDefinition *aromaDef = [SCEntityDefinition definitionWithEntityName:@"Aromas" managedObjectContext:context propertyNamesString:@"name;make;desc;pg;type"];
//Create Relation to Aroma SCPropertyDefinition *aromaRelDef = [recipeDef propertyDefinitionWithName:@"r2a"]; aromaRelDef.title = @"Aromas"; aromaRelDef.type = SCPropertyTypeArrayOfObjects; aromaRelDef.attributes = [SCArrayOfObjectsAttributes attributesWithObjectDefinition:aromaDef allowAddingItems:YES allowDeletingItems:YES allowMovingItems:YES];
If I use SCPropertyTypeSelection to retrieve Ingredients instead, I can fill a NSArray with NSStrings which I retrieve through a normal Core Data Request, but loose the ability to add new Ingredients through the Framework
Summary:
I would like to retrieve a list of already existing ingredients and also have the ability to add new ones, all via the framework
Has anyone and advice on how I can achieve this with SC? or maybe a snippet of code for demonstration?
Thanks and best regards
Vince
PS: in the screenshot attached, the ingredients are represented with aromas
Attached Files
Edited by ibesuf, 08 April 2014 - 12:30 PM.