Custom create array record

View: New views
11 Messages — Rating Filter:   Alert me  

Custom create array record

by Marco van den Oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by modius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


What is the error?

-- gb

On Nov 3, 9:14 am, Marco van den Oever <marcovandenoe...@...>
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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Marco van den Oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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 <mod...@...> wrote:

> What is the error?
>
> -- gb
>
> On Nov 3, 9:14 am, Marco van den Oever <marcovandenoe...@...>
> 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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Tomek Kott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <marcovandenoever@...> 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 <mod...@...> wrote:
> What is the error?
>
> -- gb
>
> On Nov 3, 9:14 am, Marco van den Oever <marcovandenoe...@...>
> 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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Marco van den Oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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 <tkott.s...@...> 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 <
>
> marcovandenoe...@...> 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 <mod...@...> wrote:
> > > What is the error?
>
> > > -- gb
>
> > > On Nov 3, 9:14 am, Marco van den Oever <marcovandenoe...@...>
> > > 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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Tomek Kott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <marcovandenoever@...> 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 <tkott.s...@...> 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 <
>
> marcovandenoe...@...> 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 <mod...@...> wrote:
> > > What is the error?
>
> > > -- gb
>
> > > On Nov 3, 9:14 am, Marco van den Oever <marcovandenoe...@...>
> > > 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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Marco van den Oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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 <tkott.s...@...> 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 <
>
> marcovandenoe...@...> 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 <tkott.s...@...> 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 <
>
> > > marcovandenoe...@...> 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 <mod...@...> wrote:
> > > > > What is the error?
>
> > > > > -- gb
>
> > > > > On Nov 3, 9:14 am, Marco van den Oever <marcovandenoe...@...>
> > > > > 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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Tomek Kott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <marcovandenoever@...> 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 <tkott.s...@...> 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 <
>
> marcovandenoe...@...> 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 <tkott.s...@...> 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 <
>
> > > marcovandenoe...@...> 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 <mod...@...> wrote:
> > > > > What is the error?
>
> > > > > -- gb
>
> > > > > On Nov 3, 9:14 am, Marco van den Oever <marcovandenoe...@...>
> > > > > 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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Marco van den Oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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 <tkott.s...@...> 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 <
>
> marcovandenoe...@...> 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 <tkott.s...@...> 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 <
>
> > > marcovandenoe...@...> 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 <tkott.s...@...> 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 <
>
> > > > > marcovandenoe...@...> 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 <mod...@...> wrote:
> > > > > > > What is the error?
>
> > > > > > > -- gb
>
> > > > > > > On Nov 3, 9:14 am, Marco van den Oever <
> > marcovandenoe...@...>
> > > > > > > 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: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Marco van den Oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi it's me again, i have this code:

<!--- loop over available dmimage objectid's --->
<cfloop index="i" list="#dmimage_bindinguuid#">
<cfset stprops.aemailafbeeldingen = ArrayNew(1)>
<cfset stprops.aemailafbeeldingen = ArrayAppend
(stprops.aemailafbeeldingen, i)>
</cfloop>

The i holds a valid uuid value, the object record is inserted but the
above related array isn't.
This code is above the createdata of the object.

What am i doing wrong... :(

On Nov 3, 9:22 pm, Marco van den Oever <marcovandenoe...@...>
wrote:

> 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 <tkott.s...@...> 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 <
>
> > marcovandenoe...@...> 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 <tkott.s...@...> 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 <
>
> > > > marcovandenoe...@...> 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 <tkott.s...@...> 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 <
>
> > > > > > marcovandenoe...@...> 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 <mod...@...> wrote:
> > > > > > > > What is the error?
>
> > > > > > > > -- gb
>
> > > > > > > > On Nov 3, 9:14 am, Marco van den Oever <
> > > marcovandenoe...@...>
> > > > > > > > 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 =
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Custom create array record

by Tomek Kott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

well my first thought is that you are creating a new array every time you run the loop, so you're only ever going to have 1 objectid in your array. Put the arrayNew outside the loop, and only initilize it once in the entire page.

On Thu, Nov 5, 2009 at 12:21 PM, Marco van den Oever <marcovandenoever@...> wrote:

Hi it's me again, i have this code:

<!--- loop over available dmimage objectid's --->
<cfloop index="i" list="#dmimage_bindinguuid#">
<cfset stprops.aemailafbeeldingen = ArrayNew(1)>
<cfset stprops.aemailafbeeldingen = ArrayAppend
(stprops.aemailafbeeldingen, i)>
</cfloop>

The i holds a valid uuid value, the object record is inserted but the
above related array isn't.
This code is above the createdata of the object.

What am i doing wrong... :(

On Nov 3, 9:22 pm, Marco van den Oever <marcovandenoe...@...>
wrote:
> 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 <tkott.s...@...> 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 <
>
> > marcovandenoe...@...> 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 <tkott.s...@...> 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 <
>
> > > > marcovandenoe...@...> 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 <tkott.s...@...> 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 <
>
> > > > > > marcovandenoe...@...> 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 <mod...@...> wrote:
> > > > > > > > What is the error?
>
> > > > > > > > -- gb
>
> > > > > > > > On Nov 3, 9:14 am, Marco van den Oever <
> > > marcovandenoe...@...>
> > > > > > > > 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 =
>
> ...
>
> read more »



--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---