Question Pedro Lopes · Aug 31, 2023

The program below works perfectly when I call it directly from the Terminal, however when I call it from within a CSP it does not work (It does not do the SELECT).

In the USER namespace, the program works both in the Terminal and on the CSP , but in another namespace it only works when called directly in the Terminal.

PropList(class) ;
 k pl S c=0 s class="'"_class_"'"
 K ^PropList s ^PropList=class
 S lista=$SYSTEM.SQL.Execute("SELECT * FROM Projet.GerePageCSP")
 while lista.%Next() {
 S c=c+1,pl(c)=lista.%Get("NomdePage")
 S ^PropList(c)=pl(c)
 }
 Q

________________________ CSP _______________________

4
0 323
Question Pedro Lopes · Aug 9, 2023

Class Contatos.Amiguinho Extends %Persistent
{
Property Moradia As Cidade;

Relationship Trabalho As Contatos.Empresa [ Cardinality = one, Inverse = Nomedaempresa ];
}

------------------------Routine-----------------------------------
Set objcontato=##class(Contatos.Amiguinho).%New()
Set IDm=3,IDt=2
Set objcontato.Moradia=##class(Contatos.Cidade).%OpenId(IDm)    ;<-- it works for "Property Moradia As Cidade"
Set objcontato.Trabalho=##class(Contatos.Empresa).%OpenId(IDt)  ;<-- it doesn't works for "Relationship Trabalho As Contatos.Empresa"
Set ret=objcontato.%Save()

15
0 280
Question Pedro Lopes · May 12, 2023

If I had:
________________________________________
Class MN.Student Extends %Persistent
{
Property Name As %String;
________________________________________
Class MN.Course Extends %Persistent
{
Property TeacherName As %String;
Relationship StudentName As MN.Student [ Cardinality = one, Inverse = Name ];
________________________________________

For "Cardinality = one" the SQL line below would be sufficient for archiving
INSERT INTO MN.Course (TeacherName, StudentName) VALUES ('Pierre','3')"

________________________________________

1
0 184