Question
· Jan 29, 2018

<PROPERTY DOES NOT EXIST> *Chapters,Test.Book

Hi. I am newby in Cache. My source code at below. I have problem in Relationship property. Could you please help?

 /// 
Class Test.Book Extends %Persistent
{

Property Name As %String;

Property Author As %String;

Property ISBN As %String;

Relationship Chapters As Test.Chapter [ Cardinality = children, Inverse = bookid ];

}
 Class Test.Chapter Extends %Persistent
{

Property Name As %String;

Property Page As %Integer;

Relationship bookid As Test.Book [ Cardinality = parent, Inverse = Chapters ];

}

then in terminal I am running these commands:

USER>set c1 = ##class(Test.Chapter).%New()
USER>set c1.Name = "Introduction"
USER>set c1.Page = 10
USER>set c2 = ##class(Test.Chapter).%New()
USER>set c2.Name = "Development of DB"
USER>set c2.Page = 13
USER>set b = ##class(Test.Book).%OpenId(1)

USER>do b.Chapters.Insert(c1)

after last command I got "property does not exist". Have you any opinion?

P.S. I compiled source code

Discussion (8)1
Log in or sign up to continue

Could you repeat my commands?

USER>do $system.OBJ.Compile("Test.*","cdk-u")

Compilation started on 01/29/2018 08:42:30 with qualifiers 'cdk-u'
Compiling 2 classes, using 2 worker jobs
Compiling class Test.Book
Compiling class Test.Chapter
Compiling table Test.Book
Compiling table Test.Chapter
Compiling routine Test.Book.1
Compiling routine Test.Chapter.1
Compilation finished successfully in 0.691s.

USER>set b = ##class(Test.Book).%New()

USER>w b.Chapters
7@%Library.RelationshipObject

If you got almost the same, your Insert should work