Okay,
So I'm trying to implement *some* of what I saw the other night, and it's
not working. I've got a CFC called LienApplication.cfc and it contains an
init function that takes a loan number, runs three queries, and then sets
several instance variables with values returned from each of the queries.
I'm using all the setters I wrote to set those values. Then I return 'this'
(without the quotes... you know what I mean).
The problem is that if I try to instantiate the cfc and then dump the
subsequent object it's empty! No methods, no properties.. nothin'! However,
if I view it through the CFC introspection stuff (like Dave showed us the
other night), I can see all my methods.
I'm at a loss! I'.ve done this sort of thing before (once or twice) without
any problems, but now I'm trying to use the getters and setters idea. I
should also mention that I tried shortening up my init function to just:
<cffunction name="init" access="public" returntype="LienApplication">
<cfset instance.test = "ChrisRocks">
<cfreturn this>
</cffunction>
(yes, instance is a structure declared outside of the function just below
the cfcomponent tag)
I still get nothing! :o(
If instead of trying to just do a <cfdump var="#myobj#"> I try to do
something like <cfdump var="#getCustomerFirstName()#"> I get an error
telling me that "Element Instance.CustomerFirstName is undefined in
Variables". :o(
I'll reprint my entire cfc here (and attach it as well) for anyone who
thinks they'd like to take a look at it and could help me out. I've got to
run home and celebrate my mother's birthday, but I'll be online later this
evening to see if anyone has responded.
Thanks so much everyone!
Chris
--
http://cjordan.us
<cfcomponent displayName="LienApplication" hint="This is a Title Lien
Application">
<cfset variables.instance = structNew()>
<cffunction name="init" access="public" returntype="LienApplication">
<cfargument name="LoanNumber" type="string" required="true">
<cfset var my = structNew()>
<!--- start by getting the loan information --->
<cfset my.Loan = CreateObject("component", "Loan")>
<cfset my.LoanInfo =
my.Loan.getLoanByNumber(arguments.LoanNumber)>
<!--- now get the customer information from cashwise --->
<cfset my.Customer = CreateObject("component", "Customer")>
<cfset my.CustomerInfo =
my.Customer.getCustomerInformation(my.LoanInfo.SSN)>
<!--- now get the store information from cashwise --->
<cfset my.StoreNumber
=ListFirst(my.CustomerInfo.CustomerNumber, "-")>
<cfquery name="my.StoreInfo"
datasource="#application.cashwise#">
select ID as StoreNumber, Store_Name, Store_Address,
Store_City, Store_State, Store_Zip
from location
where ID = '#my.StoreNumber#'
</cfquery>
<!--- call the setters --->
<cfif my.CustomerInfo.RecordCount>
<!--- set customer info --->
<cfset
setCustomerFirstName(Trim(my.CustomerInfo.FirstName))>
<cfset
setCustomerLastName(Trim(my.CustomerInfo.LastName))>
<cfset
setCustomerAddress(Trim(my.CustomerInfo.AddressLine1))>
<cfset setCustomerCity(Trim(my.CustomerInfo.City))>
<cfset setCustomerState(Trim(my.CustomerInfo.State))>
<cfset setCustomerZip(Trim(my.CustomerInfo.Zip))>
</cfif>
<cfif my.StoreInfo.RecordCount>
<!--- set store information --->
<cfset setStoreNumber(Trim(my.StoreInfo.StoreNumber))>
<cfset setStoreName(Trim(my.StoreInfo.Store_Name))>
<cfset
setStoreAddress(Trim(my.StoreInfo.Store_Address))>
<cfset setStoreCity(Trim(my.StoreInfo.Store_City))>
<cfset setStoreState(Trim(my.StoreInfo.Store_State))>
<cfset setStoreZip(Trim(my.StoreInfo.Store_Zip))>
</cfif>
<cfif my.LoanInfo.RecordCount>
<!--- set loan information --->
<cfset setVIN(Trim(my.LoanInfo.VIN))>
<cfset setModelYear(Trim(my.LoanInfo.ModelYear))>
<cfset setMake(Trim(my.LoanInfo.Make))>
<cfset setModel(Trim(my.LoanInfo.Model))>
<cfset setBodyStyle(Trim(my.LoanInfo.BodyStyle))>
<cfset setMileage(Trim(my.LoanInfo.Mileage))>
<cfset setLicensePlate(Trim(my.LoanInfo.License))>
</cfif>
<cfreturn this>
</cffunction>
<!--- SETTERS --->
<cffunction name="setCustomerFirstName" returntype="void">
<cfargument name="FirstName" type="string" required="true">
<cfset variables.instance.CustomerFirstName =
Trim(arguments.FirstName)>
</cffunction>
<cffunction name="setCustomerLastName" returntype="void">
<cfargument name="LastName" type="string" required="true">
<cfset variables.instance.CustomerLastName =
Trim(arguments.LastName)>
</cffunction>
<cffunction name="setCustomerAddress" returntype="void">
<cfargument name="Address" type="string" required="true">
<cfset variables.instance.CustomerAddress =
Trim(arguments.Address)>
</cffunction>
<cffunction name="setCustomerCity" returntype="void">
<cfargument name="City" type="string" required="true">
<cfset variables.instance.CustomerCity = Trim(arguments.City)>
</cffunction>
<cffunction name="setCustomerState" returntype="void">
<cfargument name="State" type="string" required="true">
<cfset variables.instance.CustomerState = Trim(arguments.State)>
</cffunction>
<cffunction name="setCustomerZip" returntype="void">
<cfargument name="Zip" type="string" required="true">
<cfset variables.instance.CustomerZip = Trim(arguments.Zip)>
</cffunction>
<cffunction name="setStoreNumber" returntype="void">
<cfargument name="StoreNumber" type="string" required="true">
<cfset variables.instance.StoreNumber =
Trim(arguments.StoreNumber)>
</cffunction>
<cffunction name="setStoreName" returntype="void">
<cfargument name="StoreNumber" type="string" required="true">
<cfset variables.instance.StoreNumber =
Trim(arguments.StoreNumber)>
</cffunction>
<cffunction name="setStoreAddress" returntype="void">
<cfargument name="StoreAddress" type="string" required="true">
<cfset variables.instance.StoreAddress =
Trim(arguments.StoreAddress)>
</cffunction>
<cffunction name="setStoreCity" returntype="void">
<cfargument name="StoreCity" type="string" required="true">
<cfset variables.instance.StoreCity = Trim(arguments.StoreCity)>
</cffunction>
<cffunction name="setStoreState" returntype="void">
<cfargument name="StoreState" type="string" required="true">
<cfset variables.instance.StoreState =
Trim(arguments.StoreState)>
</cffunction>
<cffunction name="setStoreZip" returntype="void">
<cfargument name="StoreZip" type="string" required="true">
<cfset variables.instance.StoreZip = Trim(arguments.StoreZip)>
</cffunction>
<cffunction name="setVIN" returntype="void">
<cfargument name="VIN" type="string" required="true">
<cfset variables.instance.VIN = Trim(arguments.VIN)>
</cffunction>
<cffunction name="setModelYear" returntype="void">
<cfargument name="ModelYear" type="string" required="true">
<cfset variables.instance.ModelYear = Trim(arguments.ModelYear)>
</cffunction>
<cffunction name="setMake" returntype="void">
<cfargument name="Make" type="string" required="true">
<cfset variables.instance.Make = Trim(arguments.Make)>
</cffunction>
<cffunction name="setModel" returntype="void">
<cfargument name="Model" type="string" required="true">
<cfset variables.instance.Model = Trim(arguments.Model)>
</cffunction>
<cffunction name="setMileage" returntype="void">
<cfargument name="Mileage" type="string" required="true">
<cfset variables.instance.Mileage = Trim(arguments.Mileage)>
</cffunction>
<cffunction name="setBodyStyle" returntype="void">
<cfargument name="BodyStyle" type="string" required="true">
<cfset variables.instance.BodyStyle = Trim(arguments.BodyStyle)>
</cffunction>
<cffunction name="setLicensePlate" returntype="void">
<cfargument name="LicensePlate" type="string" required="true">
<cfset variables.instance.LicensePlate =
Trim(arguments.LicensePlate)>
</cffunction>
<!--- GETTERS --->
<cffunction name="getCustomerFirstName" returntype="string">
<cfreturn variables.instance.CustomerFirstName>
</cffunction>
<cffunction name="getCustomerLastName" returntype="string">
<cfreturn variables.instance.CustomerLastName>
</cffunction>
<cffunction name="getCustomerAddress" returntype="string">
<cfreturn variables.instance.CustomerAddress>
</cffunction>
<cffunction name="getCustomerCity" returntype="string">
<cfreturn variables.instance.CustomerCity>
</cffunction>
<cffunction name="getCustomerState" returntype="string">
<cfreturn variables.instance.CustomerState>
</cffunction>
<cffunction name="getCustomerZip" returntype="string">
<cfreturn variables.instance.CustomerZip>
</cffunction>
<cffunction name="getStoreNumber" returntype="string">
<cfreturn variables.instance.StoreNumber>
</cffunction>
<cffunction name="getStoreName" returntype="string">
<cfreturn variables.instance.StoreNumber>
</cffunction>
<cffunction name="getStoreAddress" returntype="string">
<cfreturn variables.instance.StoreAddress>
</cffunction>
<cffunction name="getStoreCity" returntype="string">
<cfreturn variables.instance.StoreCity>
</cffunction>
<cffunction name="getStoreState" returntype="string">
<cfreturn variables.instance.StoreState>
</cffunction>
<cffunction name="getStoreZip" returntype="string">
<cfreturn variables.instance.StoreZip>
</cffunction>
<cffunction name="getVIN" returntype="string">
<cfreturn variables.instance.VIN>
</cffunction>
<cffunction name="getModelYear" returntype="string">
<cfreturn variables.instance.ModelYear>
</cffunction>
<cffunction name="getMake" returntype="string">
<cfreturn variables.instance.Make>
</cffunction>
<cffunction name="getModel" returntype="string">
<cfreturn variables.instance.Model>
</cffunction>
<cffunction name="getMileage" returntype="string">
<cfreturn variables.instance.Mileage>
</cffunction>
<cffunction name="getBodyStyle" returntype="string">
<cfreturn variables.instance.BodyStyle>
</cffunction>
<cffunction name="getLicensePlate" returntype="string">
<cfreturn variables.instance.LicensePlate>
</cffunction>
<cffunction name="getMomento" returntype="struct">
<cfreturn variables.instance>
</cffunction>
<!--- Other Methods --->
<cffunction name="WriteLienApp" returntype="any">
<cfset var my = structNew()>
<cfif getStoreState() eq "NM">
<cfset my.FilePath = "C:\LienApps">
<cfset my.FileName = "LienApplication_" &
DateFormat(Now(), "YYYYMMDD.HHMMSS") & ".pdf">
<cfpdfform source="PDF/Texas/Texas Title
Application.pdf" action="populate" destination="#my.FilePath#\#my.FileName#"
overwrite="yes">
<cfpdfsubform name="F">
<cfpdfsubform name="P1">
<!--- start by setting the date
in box 16 of the form (1st Lien Date) --->
<cfset my.FirstLienDate =
DateFormat(Now(), "MM/DD/YYYY")>
<cfpdfformparam name="Date"
index="2" value="#my.FirstLienDate#">
<!--- then check the "Add Lien"
checkbox --->
<cfpdfformparam
name="CheckBox2" index="13" value="1">
<!--- now set the remaining
information from the loans above --->
<!--- Customer Information --->
<cfpdfformparam name="Control"
index="14" value="#getCustomerFirstName()# #getCustomerLastName()#">
<cfpdfformparam name="Control"
index="15" value=""><!--- space for an extra owner's name --->
<cfpdfformparam name="Control"
index="16" value="#getCustomerAddress()#">
<cfpdfformparam name="Control"
index="17" value="#getCustomerCity()#, #getCustomerState()#,
#getCustomerZip()#">
<!--- Physical Location --->
<cfpdfformparam name="Control"
index="22" value="#getCustomerAddress()#">
<cfpdfformparam name="Control"
index="23" value="#getCustomerCity()#, #getCustomerState()#,
#getCustomerZip()#">
<!--- Store Information --->
<cfpdfformparam name="Control"
index="32" value="#getStoreName()#">
<cfpdfformparam name="Control"
index="33" value="#getStoreAddress()#">
<cfpdfformparam name="Control"
index="34" value="#getStoreCity()#, #getStoreState()#, #getStoreZip()#">
<!--- Vehicle Information --->
<cfpdfformparam name="Control"
index="2" value="#getVIN()#">
<cfpdfformparam name="Control"
index="3" value="#getModel()#">
<cfpdfformparam name="Control"
index="4" value="#getMileage()#">
<cfpdfformparam name="Control"
index="7" value="#getMake()#">
<cfpdfformparam name="Control"
index="8" value="#getBodyStyle()#">
<cfpdfformparam name="Control"
index="12" value="#getLicensePlate()#">
<cfpdfformparam name="Control"
index="62" value="#getModelYear()#">
</cfpdfsubform>
</cfpdfsubform>
</cfpdfform>
<cfset my.Link = "<a href='" & my.FilePath & "\" &
my.FileName & "'>" & my.FileName & "</a>">
<cfreturn my.Link>
</cfif>
<cfreturn getStoreState()>
</cffunction>
</cfcomponent>_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.instantspot.com/
www.teksystems.com/