OK got it, so it's all even easier then i thought! Will change the multiple objectid's, thanks for you time :)
On Nov 3, 5:27 pm, Tomek Kott <[email protected]> wrote: > Marco, > > What I mean is that you should do something like: > > <!--- write email to db ---> > <cfset obj = createObject > ('component',application. > stcoapi.emailberichten.typePath) /> > <cfset stprops = {} /> > <cfset stprops.objectid = emailantwoordobjectid_bindinguuid /> > <cfset stprops.emailadresontvanger = accountemails.to /> > > <!--- strip emailaddress sender mail from any name convention ---> > <cfif not listcontains(accountemails.from,"<")> > <cfset stprops.emailadresverzender = accountemails.from /> > <cfelse> > <cfset emailadresverzender = listlast(accountemails.from,"<")> > <cfset emailadresverzender = replace(emailadresverzender,">","")> > <cfset stprops.emailadresverzender = emailadresverzender /> > </cfif> > > <cfset stprops.emailonderwerp = accountemails.subject /> > <cfset stprops.emailtekst = accountemails.body /> > <cfset stprops.label = accountemails.subject /> > <cfset stprops.emailbestanden = accountemails.attachments /> > <cfset stprops.substatus = "ongelezen" /> > > <!---- INSERT REFERENCES TO IMAGE / FILE HERE ----> > <cfset stprops.aemailafbeeldingen = ArrayNew(1)> > <cfset stprops.aemailafbeeldingen = ArrayAppend(stprops.aemailafbeeldingen, > OBJECTID OF IMAGES)> > <cfset stprops.aemailafbeeldingen = ArrayAppend(stprops.aemailafbeeldingen, > OBJECTID OF FILES)> > > <cfset obj.createData(stProperties=stprops) /> > > Once you have saved the dmFile and dmImage objects, all you need is their > object id's to insert into the array. You don't need to run any createData > on FarCry's "CreateData" function will then take care of the rest. > > Also, I noticed that your dmFile, your dmImage, and your email all have the > objectid "emailantwoordobjectid_bindinguuid"... that's gonna be a problem as > well since each object in farcry should have a unique objectid. > > What I mean by parent object is the email object > "application.stcoapi.emailberichten.typePath"... > > Tomek > > On Tue, Nov 3, 2009 at 10:44 AM, Marco van den Oever < > > [email protected]> wrote: > > > OK, here is more, i don't understand "you want to go > > through the parent object and update it through there", could you in > > turn send me a little code example please?: > > > <!--- if the current file extension is in the imageextensionlist, > > write the file to dmimage and set to emailberichten_aemailafbeeldingen > > array ---> > > <cfif listcontains(imageextensionslist,"#listlast > > (accountemails.attachments,".")#",".")> > > > <!--- write the file to dmimage ---> > > <cfset obj = createObject > > ('component',application.stcoapi.dmimage.typePath) /> > > <cfset stprops = {} /> > > <cfset stprops.objectid = emailberichten_aemailbestanden_bindinguuid / > > > <cfset stprops.emailantwoordobjectid = > > emailantwoordobjectid_bindinguuid /> > > <cfset stprops.alt = accountemails.attachments /> > > <cfset stprops.label = accountemails.attachments /> > > <cfset stprops.sourceimage = "/images/dmimage/sourceimage/ > > #accountemails.attachments#" /> > > <cfset stprops.label = accountemails.attachments /> > > <cfset stprops.status = "approved" /> > > <cfset stprops.title = accountemails.attachments /> > > <cfset obj.createData(stProperties=stprops) /> > > > <!--- set file and email objectid to emailberichten_aemailafbeeldingen > > array ---> > > <cfset obj = createObject > > ('component',application.stcoapi.emailberichten_aemailafbeeldingen.typePath) > > / > > > <cfset stprops = {} /> > > <cfset stprops.data = emailantwoordobjectid_bindinguuid /> > > <cfset stprops.parentid = emailberichten_aemailbestanden_bindinguuid / > > > <cfset stprops.seq = "1" /> > > <cfset stprops.typename = "dmImage" /> > > <cfset obj.createData(stProperties=stprops) /> > > > <!--- if the current file extension is not in the imageextensionlist, > > write the file to dmfile and set to emailberichten_aemailbestanden > > array ---> > > <cfelse> > > > <!--- write the file to dmfile ---> > > <cfset obj = createObject > > ('component',application.stcoapi.dmfile.typePath) /> > > <cfset stprops = {} /> > > <cfset stprops.objectid = emailberichten_aemailbestanden_bindinguuid / > > > <cfset stprops.emailantwoordobjectid = > > emailantwoordobjectid_bindinguuid /> > > <cfset stprops.bLibrary = "1" /> > > <cfset stprops.filename = "/dmfile/#accountemails.attachments#" /> > > <cfset stprops.label = accountemails.attachments /> > > <cfset stprops.status = "approved" /> > > <cfset stprops.title = accountemails.attachments /> > > <cfset obj.createData(stProperties=stprops) /> > > > <!--- set file and email objectid to emailberichten_aemailbestanden > > array ---> > > <cfset obj = createObject > > ('component',application.stcoapi.emailberichten_aemailafbeeldingen.typePath) > > / > > > <cfset stprops = {} /> > > <cfset stprops.data = emailantwoordobjectid_bindinguuid /> > > <cfset stprops.parentid = emailberichten_aemailbestanden_bindinguuid / > > > <cfset stprops.typename = "dmFile" /> > > <cfset obj.createData(stProperties=stprops) /> > > > </cfif> > > > <!--- write email to db ---> > > <cfset obj = createObject > > ('component',application.stcoapi.emailberichten.typePath) /> > > <cfset stprops = {} /> > > <cfset stprops.objectid = emailantwoordobjectid_bindinguuid /> > > <cfset stprops.emailadresontvanger = accountemails.to /> > > > <!--- strip emailaddress sender mail from any name convention ---> > > <cfif not listcontains(accountemails.from,"<")> > > <cfset stprops.emailadresverzender = accountemails.from /> > > <cfelse> > > <cfset emailadresverzender = listlast(accountemails.from,"<")> > > <cfset emailadresverzender = replace(emailadresverzender,">","")> > > <cfset stprops.emailadresverzender = emailadresverzender /> > > </cfif> > > > <cfset stprops.emailonderwerp = accountemails.subject /> > > <cfset stprops.emailtekst = accountemails.body /> > > <cfset stprops.label = accountemails.subject /> > > <cfset stprops.emailbestanden = accountemails.attachments /> > > <cfset stprops.substatus = "ongelezen" /> > > <cfset obj.createData(stProperties=stprops) /> > > > <!--- after succesfull inserting to db delete email from mail server > > ---> > > <cfpop action="delete" > > server="#emailaccounts.emailserver#" > > port="25" > > timeout="60" > > username="#emailaccounts.emailgebruikersnaam#" > > password="#emailaccounts.emailwachtwoord#" > > uid="#accountemails.UID#"> > > <cfcatch type="any"> > > <h1>Error while inserting email to db, the operation is aborted</h1> > > </cfcatch> > > </cftry> > > > On Nov 3, 3:05 pm, Tomek Kott <[email protected]> wrote: > > > Marco, i'm confused about your type structure. Is it the following: > > > > Email (parentid) > > > Array of dmImage and dmFile (attachmentid) > > > > And maybe attaching (rather than inline) the enitre code you're > > processing > > > would help. The point remains that FarCry doesn't handle array tables > > > directly through CreateData / SetData / GetData. Instead, you want to go > > > through the parent object and update it through there. > > > > Tomek > > > > On Tue, Nov 3, 2009 at 8:57 AM, Marco van den Oever < > > > > [email protected]> wrote: > > > > > What is happening in the code is that i receive an email which i set > > > > to a custom type, the email attachments are filtered and put into > > > > dmfile or dmimage, then i want to bind the email and the email > > > > attachments by array. > > > > > (The array is also used when people send an email and are selecting > > > > email attachments through dmfile and dmimage.) > > > > > I set an objectid bij createuuid and use that to set the email > > > > objectid and the data value for the array table, an earlier set > > > > objectid by createuuid is used to set the dmfile or dmimage objectid > > > > and the parent value for the array table. > > > > > So then do i need a structure like you state above? A appendArray > > > > structure instead of createData? > > > > > On Nov 3, 2:18 pm, Tomek Kott <[email protected]> wrote: > > > > > Marco, I believe you don't want to set the array property directly. > > > > Instead, > > > > > you want to do something like the following: > > > > > > getData( objectid of the parent ) > > > > > appendArray( dataID ) > > > > > setData. > > > > > > Basically, you need to go through the parent type to set the array > > using > > > > > setData or createData. Otherwise you need to create your own query, > > as > > > > > FarCry doesn't (I believe) work with array tables except through the > > > > > original type. > > > > > > Tomek > > > > > > On Mon, Nov 2, 2009 at 6:50 PM, Marco van den Oever < > > > > > > [email protected]> wrote: > > > > > > > I don't get an error, it's a webtop list with code that executes on > > > > > > load. > > > > > > Am debugging with cfdump, this code seems to be the problem as when > > i > > > > > > cfdump an existing variable under it, it isn't dumped but the list > > > > > > loads. > > > > > > > How can i debug better? > > > > > > > On Nov 3, 12:22 am, modius <[email protected]> wrote: > > > > > > > What is the error? > > > > > > > > -- gb > > > > > > > > On Nov 3, 9:14 am, Marco van den Oever < > > [email protected]> > > > > > > > wrote: > > > > > > > > > Hi all, > > > > > > > > > I am trying to create a array record to bind 2 items by array: > > > > > > > > > <!--- set file and email objectid to > > > > emailberichten_aemailafbeeldingen > > > > > > > > array ---> > > > > > > > > <cfset obj = createObject > > > ('component',application.stcoapi.emailberichten_aemailafbeeldingen.typePath > > > > > > ) / > > > > > > > > > <cfset stprops = {} /> > > > > > > > > <cfset stprops.data = emailantwoordobjectid_bindinguuid /> > > > > > > > > <cfset stprops.parentid = > > > > emailberichten_aemailbestanden_bindinguuid / > > > > > > > > > <cfset stprops.seq = "1" /> > > > > > > > > <cfset stprops.typename = "dmImage" /> > > > > > > > > <cfset obj.createData(stProperties=stprops) /> > > > > > > > > > All variables and table exists, any tips??? --~--~---------~--~----~------------~-------~--~----~ You received this message cos you are subscribed to "farcry-dev" Google group. To post, email: [email protected] To unsubscribe, email: [email protected] For more options: http://groups.google.com/group/farcry-dev -------------------------------- Follow us on Twitter: http://twitter.com/farcry -~----------~----~----~----~------~----~------~--~---
