If the keys in the attributes scope match the names of the arguments, you
can do:
<set name="phRecord"
value="#application.reactor.createRecord('new_district_posts').init(argumentCollection=attributes)#"
/>
On 7/26/07, David Phipps <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> After looking through the docs and some of the cfcs that Reactor creates
> I can't see if there is a shorthand way of saving a record. Below I have
> some pseudo code (actually taken from my circuit xml file):
>
> <set name="phRecord"
> value="#application.reactor.createRecord('new_district_posts')#" />
> <set name="phRecord.setDistrict_Posts_ID(
> attributes.District_Posts_ID)" />
> <set name="phRecord.setDistrict_id(attributes.District_id)"
> />
> <set
> name="phRecord.setDistrict_Post_Type_id(attributes.District_Post_Type_id)"
> />
> <set name="phRecord.setTitle(trim(attributes.title))" />
> <set name="phRecord.setCalled_Name(trim(
> attributes.Called_Name))" />
> <set name="phRecord.setInitials(trim(attributes.Initials))"
> />
> <set name="phRecord.setFirstnames(trim(
> attributes.Firstnames))" />
> <set name="phRecord.setSurname(trim(attributes.surname))"
> />
> <set name="phRecord.setADD1(trim(attributes.ADD1))" />
> <set name="phRecord.setADD2(trim(attributes.ADD2))" />
> <set name="phRecord.setADD3(trim(attributes.ADD3))" />
> <set name="phRecord.setTown(trim(attributes.Town))" />
> <set name="phRecord.setPOSTCODE(trim(attributes.POSTCODE))"
> />
> <set name="phRecord.setEmail(trim(attributes.Email))" />
> <set name="phRecord.setTelephone(trim(attributes.Telephone))"
> />
> <set name="phRecord.setMobile_Tel(trim(
> attributes.Mobile_Tel))" />
> <set name="phRecord.setWeb(trim(attributes.web))" />
> <set name="phRecord.setGender(trim(attributes.Gender))" />
> <set name="phRecord.setAddress_Type_ID(
> attributes.Address_Type_ID)" />
> <set name="phRecord.setNew_Postholder(
> attributes.New_Postholder)" />
> <set name="phRecord.save()" />
>
> Is there any way in Reactor to shorten this down by creating an array or
> argumentCollection or do I need to do the above in order to
> insert/update a record in the db with data from a form?
>
> Any suggestions appreciated.
>
> Cheers,
>
> Dave
> --
>
> _______________________________________________________________________
> David Phipps, Director
> [EMAIL PROTECTED]
>
> Chapel Studios / London
> T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7931 375040
> New Broad Street House, 35 New Broad Street, London, EC2M 1NH, UK
>
> Visit our website: http://www.chapel-studios.co.uk
>
> _______________________________________________________________________
>
> Chapel Studios is a limited company registered in England. The
> information in this email is confidential, intended solely for the
> addressee, and may be legally privileged. If you are not the
> addressee
> or authorized to receive this for the addressee, you must not use,
> copy,
> disclose or take any action based upon this message or any
> information
> herein. If you have received this message in error, please advise
> the sender immediately by reply e-mail.
>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
> Reactor for ColdFusion Mailing List
> [EMAIL PROTECTED]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
>
>
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --