since an update is not allowed, yes, then for interity, I would do the DEL
then INSERT

On Fri, May 30, 2008 at 12:50 PM, Cameron Johnson <[EMAIL PROTECTED]> wrote:

> Hello.
>
> I'm looking for some best practice advice with this one.
>
> In our membership database, we have a table where we assign membership to a
> community/group. A user can join or leave these groups on the web (simple
> checkbox form), or staff can add or remove group membership through the
> desktop client. By nature of the desktop client, there is the possibility of
> a data error, ex: populated fieldA and fieldB, but not fieldC.
>
> For the web application, upon submitting the form, I'm looping through a
> list of "itemsToAdd" and inserting those. In the event that there are bad
> records because of bad data entry from the desktop client, should I be
> deleting the to-be-inserted record before inserting?
>
> (Please forgive the ham-fisted, partial object orientation of invoking the
> component for each item.)
>
> So, if I call the insert method:
>
> <cfloop list="#itemsToAdd#" index="itemsToAddIndex">
>   <cfinvoke component="components.myComponent" method="insertMethod">
>      <cfinvokeargument name="fieldA" value="#itemsToAddIndex#" />
>      <cfinvokeargument name="fieldB" value="#form.fieldB#" />
>      <cfinvokeargument name="fieldC" value="#form.fieldC#" />
>   </cfinvoke>
> </cfloop>
>
> Should I be calling the delete method first?
>
> <cfloop list="#itemsToAdd#" index="itemsToAddIndex">
>   <cfinvoke component="components.myComponent" method="deleteMethod">
>      <cfinvokeargument name="fieldA" value="#itemsToAddIndex#" />
>      <cfinvokeargument name="fieldB" value="#form.fieldB#" />
>      <cfinvokeargument name="fieldC" value="#form.fieldC#" />
>   </cfinvoke>
>   <cfinvoke component="components.communities" method="insertCommunities">
>      <cfinvokeargument name="fieldA" value="#itemsToAddIndex#" />
>      <cfinvokeargument name="fieldB" value="#form.fieldB#" />
>      <cfinvokeargument name="fieldC" value="#form.fieldC#" />
>   </cfinvoke>
> </cfloop>
>
> I've never seen something like this, but it seems like an OK idea. Anyone
> have a better solution or suggestion? Please note that I have to keep to
> inserts and deletes; no updates.
>
> Thanks for the help.
>
> Cameron
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306391
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to