You say potatoe ;-) I suppose it is what you like, personally I would do both but I find the top method easier to read.
-----Original Message----- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: 01 April 2005 14:26 To: CF-Newbie Subject: RE: Function Calling Another tip, although this is style more than anything, if you don't need to conditionally pass arguments to a function you can replace this: <cfinvoke method="LangText" returnVariable="Subject"> <cfinvokeargument name="LanguageID" value="#qryTagReplace.Language#"> <cfinvokeargument name="TextBlobID" value="#SubjectBlobID#"> </cfinvoke> with this: <cfset subject = LangText(qryTagReplace.Language, SubjectBlobID)> Whatdoyareckontothatthen? -----Original Message----- From: Richard Hensman [mailto:[EMAIL PROTECTED] Sent: 01 April 2005 14:05 To: CF-Newbie Subject: Function Calling I know, I'm hogging the brain power today... Entity has incorrect type for being called as a function. The symbol you have provided LangText is not the name of a function. I have read all the help files on what causes this error, but I don't see an example of it in my code. I am calling MailParams. - and get an error on <cfinvokeargument name="TextBlobID" value="#SubjectBlobID#"> This was working just now, but I can't see why anything here's broken it... Please help! (I have removed a couple of queries, and some variable declarations, so if there's a variable being used, it's being declared somewhere :) ) <cffunction name = "LangText" returnType = "String" output = "no" > <cfargument name="TextBlobID" type="numeric" required="Yes"> <cfargument name="LanguageID" type="numeric" required="Yes"> <cfquery name = "qryLangText" dataSource = "#datasource#"> Select Top 1 Text from TextBlobField where TextBlobID = #TextBlobID# and LanguageID = #LanguageID# and IsDraft = 0 Order by TextBlobField.DateStamp desc </cfquery> <cfreturn qryLangText.Text> </cffunction> <cffunction name = "MailParams" returnType = "Struct" output = "no" > <cfargument name="TemplateID" type="numeric" required="Yes"> <cfargument name="RecipientID" type="numeric" required="Yes"> <cfargument name="ItemIDs" type="string" required="No" default="0"> <cfargument name="UserID" type="numeric" required="No" default="0"> <cfargument name="AdminID" type="numeric" required="No" default="0"> <cfargument name="Address" type="String" required="No" default=""> <cfset Ret = StructNew()> <cfset Subject = ""> <cfset To = ""> <cfset From = ""> <cfset Body = ""> <cfquery name = "qryTemplate" dataSource = "#datasource#"> Select IsNull(FromAdd, '') as FromAdd, IsNull(SubjectTextBlobID, 0) as SubjectTextBlobID, IsNull(BodyTextBlobID, 0) as BodyTextBlobID from Email where EmailID = #TemplateID# </cfquery> <cfset From = qryTemplate.FromAdd> <cfset SubjectBlobID = qryTemplate.SubjectTextBlobID> <cfset BodyBlobID = qryTemplate.BodyTextBlobID> <cfset StartDate = Now()> <cfset StartDate = "2005/1/1"> <cfif RecipientID gt 0> <cfquery name = "qryTagReplace" dataSource = "#datasource#"> </cfquery> <cfelse> <cfquery name = "qryTagReplace" dataSource = "#datasource#"> </cfquery> </cfif> <cfif TemplateID gt 0> <cfinvoke method="LangText" returnVariable="Subject"> <cfinvokeargument name="LanguageID" value="#qryTagReplace.Language#"> <cfinvokeargument name="TextBlobID" value="#SubjectBlobID#"> </cfinvoke> <cfinvoke method="LangText" returnVariable="Body"> <cfinvokeargument name="LanguageID" value="#qryTagReplace.Language#"> <cfinvokeargument name="TextBlobID" value="#BodyBlobID#"> </cfinvoke> <cfquery name = "qryTags" datasource = "#datasource#"> Select * from SmartTag where ColumnName is not Null and ColumnName <> '' </cfquery> <cfset HeadEnd = findnocase(BodyStart, Body)-1> <cfset FootStart = findnocase(BodyEnd, Body)+len(BodyEnd)> <cfif HeadEnd gt 0 and FootStart gt 0> <cfset Header = left(Body, HeadEnd)> <cfset Footer = right(Body, len(Body)-FootStart)> <cfset Block = mid(Body, HeadEnd+len(BodyStart), len(Body)-len(Header)-len(Footer)-len(BodyStart)-len(BodyEnd))> <cfelse> <cfset Header = ""> <cfset Footer = ""> <cfset Block = Body> </cfif> <cfset Body = ""> <cfset To = qryTagReplace.rec_Email> <cfloop query="qryTags"> <cfset From = replace(From, "{"&qryTags.Tag&"}", qryTagReplace[qryTags.ColumnName][1], "all")> <cfset Subject = replace(Subject, "{"&qryTags.Tag&"}", qryTagReplace[qryTags.ColumnName][1], "all")> <cfset Header = replace(Header, "{"&qryTags.Tag&"}", qryTagReplace[qryTags.ColumnName][1], "all")> <cfset Footer = replace(Footer, "{"&qryTags.Tag&"}", qryTagReplace[qryTags.ColumnName][1], "all")> </cfloop> <cfloop from="1" to="#qryTagReplace.recordcount#" index="Record"> <cfset TmpBlock = Block> <cfloop query="qryTags"> <cfset TmpBlock = replace(TmpBlock, qryTags.Tag, qryTagReplace[qryTags.ColumnName][Record], "all")> </cfloop> <cfset Body = Body & TmpBlock> </cfloop> <cfset Body = Header & Body & Footer> </cfif> <cfset session.EmailEventInsert = " Insert into EmailEvent (EmailID, LanguageID, IsModified, AGUserID,ItemID) Values (#TemplateID#,#qryTagReplace.Language#,0,#RecipientID#,#ItemIDs#)"> <cfset Ret.From = From> <cfset Ret.Subject = Subject> <cfset Ret.Body = Body> <cfset Ret.To = To> <cfreturn Ret> </cffunction> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Purchase Flash MX Pro from House of Fusion, a Macromedia Authorized Affiliate and support the CF community. http://www.houseoffusion.com/banners/view.cfm?bannerid=57 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:819 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
