Answered
custom tags
Hi
I am new to CF and I am creating a custom tag with two attributes. However when calling the custom tag with name as "datefrom" and date as 01/01/2008, the calling page came with this error: "Variable DATEFROM is undefined".
In my custom tag:
<cfparam name="Attributes.date">
<cfparam name="Attributes.name">
<cfset dateA = "#Attributes.date#">
<cfset dateB = "#mid(dateA,7,4)&'-'&mid(dateA,4,2)&'-'&mid(dateA,1,2)#">
<cfset #Attributes.name# = "#dateB#">
Calling page:
<cf_convertdatetoSQL date="url.fromdate" name="datefrom">
<cf_convertdatetoSQL date="url.todate" name="dateto">
<cfquery name="balancesheet" datasource=#url.code#>
SELECT AccountCategories.accountcategoryname, sum(Transactions.debit) AS Total,dbo.accountcategories.acctype
FROM dbo.AccountCategories, dbo.AccountNumbers, dbo.Transactions
WHERE dbo.AccountCategories.accountcategoryno = dbo.AccountNumbers.accountcategoryno
AND dbo.AccountNumbers.accountno = dbo.Transactions.accountno
AND dbo.Transactions.date BETWEEN '#datefrom#' AND '#dateto#'
GROUP BY dbo.accountcategories.accountcategoryname,dbo.accountcategories.acctype
ORDER BY CHARINDEX(dbo.accountcategories.acctype, 'Asset,Liability,Equity') ASC
</cfquery>
etc..
Can anyone please let me know what I am doing wrong?
Thanks
I am new to CF and I am creating a custom tag with two attributes. However when calling the custom tag with name as "datefrom" and date as 01/01/2008, the calling page came with this error: "Variable DATEFROM is undefined".
In my custom tag:
<cfparam name="Attributes.date">
<cfparam name="Attributes.name">
<cfset dateA = "#Attributes.date#">
<cfset dateB = "#mid(dateA,7,4)&'-'&mid(dateA,4,2)&'-'&mid(dateA,1,2)#">
<cfset #Attributes.name# = "#dateB#">
Calling page:
<cf_convertdatetoSQL date="url.fromdate" name="datefrom">
<cf_convertdatetoSQL date="url.todate" name="dateto">
<cfquery name="balancesheet" datasource=#url.code#>
SELECT AccountCategories.accountcategoryname, sum(Transactions.debit) AS Total,dbo.accountcategories.acctype
FROM dbo.AccountCategories, dbo.AccountNumbers, dbo.Transactions
WHERE dbo.AccountCategories.accountcategoryno = dbo.AccountNumbers.accountcategoryno
AND dbo.AccountNumbers.accountno = dbo.Transactions.accountno
AND dbo.Transactions.date BETWEEN '#datefrom#' AND '#dateto#'
GROUP BY dbo.accountcategories.accountcategoryname,dbo.accountcategories.acctype
ORDER BY CHARINDEX(dbo.accountcategories.acctype, 'Asset,Liability,Equity') ASC
</cfquery>
etc..
Can anyone please let me know what I am doing wrong?
Thanks
