hi bill,
thanks - yes i noticed that i have a one to many relation
and i simply tried to change in the class definition code the "many" to
"one"
but with the wizard does not support this one : one ... ?!
(with several forms in csp it creates a record for the header class - but
the entry for the conent class is not set ?)
so may be i would not need a separate class for this
- it should indeed a 1:1 ...
- but for oo design reasons i use a separate class for header/body/footer
and a comon parent class...
now i did the folloeing:
- i use several forms und csp object bindings
- and i changed the relation to a simple property of type header/body/footer
class in both classes
(like a foreign key)
- so i have to handle that the content class property on crating a header
record by ma self
i tried it with a %On AfterSave Method:
Method %OnAfterSave(Insert as %Library.Boolean) As %Library.Status
{
// write "OnAfterSave ", ..%Id() , " - " , ..Content.Header(),!
set ..Content.Header = ..%Id()
set sc = ..Content.%Save()
QUIT sc
}
but the Content.Header Property (former the relation) is still not set ?
any idea what I did wrong ?
no error message anywhere - the trace is also not shown - neither if i use
%OnBeforeSave an
add a :
if (js.length > 0) {
// alert(js);
var bidding = new Function('CSPPage', js);
bidding(self);
}
in CPS/broker/cspbroker.js ...
brg
werner
"Bill McCormick" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> This is too complex a structure for the basic binding. It can handle
> simple one-one pointer objects and CAN handle related ones as well where
> relationship between the two has been clearly defined that is not the
> case here. You have a one to many relationship between the Content and
> Header class but your bind says Header.Name - this is not correct. The
> reference would look something like Header.GetAt(x).Name. You have not
> bound the Header object so we are not creating a new record regardless
> of whether you could provide the x and get access to an existing. A
> better approach is a form for modifying the Header where you make
> certain to provide a cspbind property on the Content "One" object. We
> can generate code to handle that. You could write your own logic for
> saving/retrieving data from this page and still implement this with CSP.
> We simply can't generate a binding for it.
>
>
> Dipl.-Ing. Werner Riegler wrote:
> > hi there again,
> >
> > can anybody tell me if it should work
> > to create and save referenced objects within the same form as the object
> > itself ?
> >
> > i use a standard wizard generated form - but it does not seam to work ?
> > (no error - but noting created)
> >
> > Class EMEM.Content Extends EMEM.NLSObject [ ClassType = persistent,
> > ProcedureBlock ]
> > {
> > Relationship Body As EMEM.ContentBody [ Cardinality = one, Inverse =
> > Content ];
> > Relationship Campaigns As EMEM.CampaignContents [ Cardinality = many,
> > Inverse = Contents ];
> > Relationship Footer As EMEM.ContentFooter [ Cardinality = one, Inverse =
> > Content ];
> > Relationship Header As EMEM.ContentHeader [ Cardinality = one, Inverse =
> > Content ];
> > Relationship SubContent As EMEM.SubContent [ Cardinality = many, Inverse
=
> > Content ];
> > Query ContentList() As %SQLQuery(CONTAINID = 1)
> > {
> > SELECT %ID,NameDe FROM Content ORDER BY NameDe
> > }
> > Index BodyIndex On Body;
> > Index FooterIndex On Footer;
> > Index HeaderIndex On Header;
> > }
> >
> > just try to create/save Content and Header (Property Name for Header):
> >
> > <!-- use CSP:OBJECT tag to create a reference to an instance of the
> > class -->
> > <csp:object name="objForm" classname="EMEM.Content"
> > OBJID=#(%request.Get("OBJID"))#>
> > <!-- use csp:search tag to create a javascript function to invoke a
search
> > page -->
> > <csp:search name="form_search" classname="EMEM.Content" where="NameDe"
> > options="popup,nopredicates" onselect="update">
> > <form name="form" cspbind="objForm" cspjs="All" onsubmit='return
> > form_validate();'>
> > <center>
> > <table cellpadding="3">
> > <tr>
> > <td><b><div align="right">NameDe:</div></b></td>
> > <td><input type="text" name="NameDe" cspbind="NameDe" size="80"></td>
> > </tr>
> > <tr>
> > <td><b><div align="right">DescriptionDe:</div></b></td>
> > <td><input type="text" name="DescriptionDe" cspbind="DescriptionDe"
> > size="80"></td>
> > </tr>
> > <tr>
> > <td><font color="#666666"><b><div align="right">Header
> > Name:</div></b></font></td>
> > <td><input type="text" name="HeaderName" cspbind="Header.Name" size="80"
> >
> >></td>
> >
> > </tr>
> > </table>
> > </center>
> > </form>
> >
> >
> > or do I need to modify or create my own form_save method to achive this
?
> >
> > brg
> > werner
> >
> >