Ok this code on the csp page works

function EditTlphone(tlphoneID,prsonID)
{
 //#server(..DeleteTlphone(intID))#;
 var Result;
 Result=#server(pkgAddressBook.cTlphones.DeleteTlphone(intID))#;
 if (Result=='1') {
 alert('Record has been removed');
 }
 else {
 alert('Unable to remove record...');
}

However, if I use
<csp:class super="%CSP.Page,pkgAddressBook.cTlphones">

and then in the script section
#server(..DeleteTlphone(intID))#;

the error comes back. Don't understand why, but thanks for the info. At
least I see it working now...

"Bernd Mueller" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> you can change your DeleteTlphone method to this ... so you don't
> need to open the object before (this is the way i prefer) ...
>
> ClassMethod DeleteTlphone(TlphoneID As %Integer) As %String
> {
>    Set sc=##class(pkgAddressBook.cTlphones).%DeleteId(TlphoneID)
>    if sc Quit 1
>    Quit 0
> }
>
>
> the error comes from the csp-page not the class.
>
> Do you have a DeleteTlphone() method inside the page ?
> I think this is what you call via #server(..DeleteTlphone(intID))#;
>
> Remove it and call the "ClassMethod" DeleteTlphone() instead via
>
> Result=#server(pkgAddressBook.cTlphones.DeleteTlphone(intID))#;
> if (Result=='1') alert('Delete ok');
>
> If this is not working please provide us with the csp-Page-Source also.
>
> Regards...
> Bernd!
>
> RJH wrote:
> > Ok, here is the complete class
> >
> >
> > Class pkgAddressBook.cTlphones Extends %Persistent [ ClassType =
persistent,
> > ProcedureBlock, SqlTableName = Tlphones ]
> > {
> >
> > Property Person As cPerson;
> >
> > Property Tlphone As %String;
> >
> > Property TlphoneType As cTlphoneTypes;
> >
> > Index TlphoneIndex On Tlphone [ Unique ];
> >
> > Query qPrsonTlphnes(PrsonID As %Integer = 0) As %SQLQuery(CONTAINID = 1)
> > {
> > SELECT
> >
%ID,Person->Category->Category,Person->Category->ID,Person->Category->ID,Per
> >
son->FirstNme,Person->ID,Person->LastNme,Tlphone,TlphoneType->ID,TlphoneType
> > ->TlphoneType FROM Tlphones
> >  WHERE (Person = :PrsonID)
> >  ORDER BY Tlphone
> > }
> >
> > ClassMethod DeleteTlphone(TlphoneID As %Integer)
> > {
> >  Set objTlphone = ##class(pkgAddressBook.cTlphones).%OpenId(TlphoneID)
> >  Do objTlphone.%Delete()
> >  //Do ##class(pkgAddressBook.cTlphones).%DeleteId(TlphoneID)
> >  //set
sc=$zobjclassmethod(pkgAddressBook.cTlphones,"%DeleteId",TlphoneID)
> > }
> >
> > }
> >
> >
> > I then call it from ShowTlphones csp
> >
> > <SCRIPT Language=JavaScript>
> > <!--
> >
> > function RmoveTlphone(intID)
> > {
> >  #server(..DeleteTlphone(intID))#;
> > }
> > // -->
> > </SCRIPT>
> >
> > And get the following error.
> >
> > csp.showtlphones.1(0) : OBJ5376 :  Method or Property '%DeleteData' does
not
> > exist in this class.
> >  TEXT:  Set sc=..%DeleteData(id,concurrency)
> >
> > Errors detected during compile.
> >
> > Before adding the delete method, everything was working fine. Can you
> > explain how to get rid of the error and the proper way to add delete
> > functionality from a csp page?
> >
> > "RJH" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>I added a method to delete a record here is the code:
> >>
> >>ClassMethod DeleteRecord(intID As %Integer)
> >>{
> >> //Set obj = ##class(ClassNamePackage.Class).%OpenId(intID)
> >> //Do obj.%Delete()
> >> //Do ##class(ClassNamePackage.Class).%DeleteId(intID)
> >> set sc=$zobjclassmethod(ClassNamePackage.Class,"%DeleteId",intID)
> >>
> >>}
> >>
> >>As you can see I tried 3 different versions. But I get the following
error
> >>
> >>Method or property %DeleteData does not exists.
> >>
> >>I removed the method, but can not re-compile. I get the same error. Can
> >>anyone help and explain what is going on?
> >>
> >>
> >
> >
> >



Reply via email to