Hi all.  I have the following:

reactor.xml

       <object name="tblLeaveStatus">
           <hasMany name="tblLeaveBalance">
               <relate from="LeaveUserID" to="LeaveUserID" />
               <relate from="LeaveYear" to="LeaveYear" />
               <relate from="LeaveMonth" to="LeaveMonth" />
           </hasMany>
      </object>


I am trying to add records to "tblLeaveBalance" using the following code:

<cfscript>
LeaveUserID=1;
LeaveMonth=1;
LeaveYear=2005;

leaveStatusRecord=application.Reactor.createRecord("tblLeaveStatus").load(LeaveMonth=LeaveMonth,LeaveYear=LeaveYear,LeaveUserID=LeaveUserID);
NewLeaveBalanceRecord=leaveStatusRecord.gettblLeaveBalanceIterator().add();
NewLeaveBalanceRecord.setLeaveType(3);
NewLeaveBalanceRecord.setLeaveBalance(600);
NewLeaveBalanceRecord.save();
</cfscript>

When I look at the table it creates a new record with LeaveType=3 and LeaveBalance=600, but LeaveUserID,leaveMonth, and LeaveYear are set to "".

It looks like I also need to do a setLeaveUserID, setLeaveMonth, and setLeaveYear. Since the "leaveStatusRecord" has been loaded, shouldn't it automatically set those fields since thta is how the tables are related?

Thanks

byron



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to