Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex object types cannot be converted to simple values

Status
Not open for further replies.

FlyingHorseman

Technical User
Oct 16, 2008
10
US
I have inherited an installation which I have to maintain and due to a cascading bunch of issues I have upgraded from ColdFusion 5 to ColdFusion 8. Simple cfm files work. Some scripts are breaking, with the error I get the title of this thread.
I have researched online and have tried some of the solutions, but, have ended up trading one error for another and got nowhere.
Any and all help will be greatly appreciated.
~Actual error reproduced here~
The error occurred in /u03/COMMON/Notices/retrieve_premier.cfm: line 10
8 :
9 : <!--- The variable #file# is the full path of the notice file (#file# was passed down as a parameter from display_premier.cfm --->
10 : <cfset file_title = "/export/home/testuser/Notices/#file#">
11 :
12 : <!--- Check whether the file exists --->
 
The problem here is #file#. File is a reserved word because it is a system structure like form FORM or URL. Structures are complex objects, but the code is treating it like a simple string.

Change the variable name to something else and it should resolve that error.

----------------------------------
 
Thank you for responding. I did read a similar post online and changed the variable from #file# to #varfile#, but, then get another error saying that variable is not defined.
Error reproduced below
Variable VARFILE is undefined.


The error occurred in /u03/COMMON/Notices/retrieve_premier.cfm: line 10
8 :
9 : <!--- The variable #varfile# is the full path of the notice file (#varfile# was passed down as a parameter from display_premier.cfm --->
10 : <cfset file_title = "/export/home/testuser/Notices/#varfile#">
11 :
12 : <!--- Check whether the file exists --->
 
1. How is the variable "passed down from display_premier.cfm". Are you including that template in the page generating the error?

ie <cfinclude template="display_premier.cfm">

2. Look in the file display_premier.cfm. Does it define a variable named #file# anywhere, or is it doing a <cffile action="upload"..? maybe?

----------------------------------
 
To clarify my last comment, you have to change the variable name at the source. So if that variable is defined in another script, you have to change the variable name there too.

----------------------------------
 
Thanks a lot in helping me resolve the problem. Your second comment helped especially where you mentioned to change the variable name at the source, as it stuck in my mind and made me realise the source of the problem.
The problem as it turned out was not in the display_premier.cfm file, but, in the latest_premier.cfm file as that was the file being called first. It was a wrong comment, put in by one of the guys/gals who worked on the code a long time ago and are no longer with the company. I changed the variable name in latest_premier.cfm file and it worked.
I did run into a similar problem on line 122, where #url# was being used, and I had read some place that it can no longer be used and renamed that as well, to get the full display.
Once again, thanks for your help. [smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top