2 Replies - 1115 Views - Last Post: 02 April 2009 - 08:06 AM Rate Topic: -----

#1 xheartonfire43x  Icon User is offline

  • D.I.C Regular

Reputation: 46
  • View blog
  • Posts: 454
  • Joined: 22-December 08

Complex variables cannot be converted to simple ones error.

Post icon  Posted 02 April 2009 - 07:30 AM

I am trying to use a CFC to pull stuff from the database. It has a bunch of functions in it. I just used the CFC so as to keep all the similar code in one aread. So the problem is that the URL variable that is almost one of the first things in each function causes an error. When I try to put it into the <a> tag it says that it is a complex variable. I am not sure if maybe I am doing it wrong or what. When I put the variable directly into the <a> tag rather than doing a <cfset> it runs fine. When I do a dump of the variable it always returns empty.

<cfcomponent>
<!---Function for saved trips--->
<cffunction name="saved">
	<cfargument name="cuuid" required="yes">
	<cfargument name="mydatasource" required="yes">
	<cfargument name="myusername" required="yes">
	<cfargument name="mypassword" required="yes">

	<cfquery name="SavedTrip" datasource="#mydatasource#" username="#myUsername#" password="#myPassword#">
		SELECT * FROM TravelReservations WHERE savedtrip = 'Y' AND cuuid = <cfqueryparam value="#cuuid#"> ORDER BY TimeStamp
	</cfquery>
	<cfif savedtrip.recordcount gt 0>
	<cfset url = "engine.cfm?formprocess=savedtrip&amp;irid=" & SavedTrip.rid>
	<cfoutput>	
		<cfloop query="SavedTrip">
			<tr>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#SavedTrip.savename#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#SavedTrip.PassengerName#
					</a>
				</td>
			<cfswitch expression="#SavedTrip.TripType#">
			<cfdefaultcase>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#SavedTrip.PickupCompany#
						#SavedTrip.PickupCity#
						#SavedTrip.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#SavedTrip.DestinationCompany#
						#SavedTrip.DestinationCity#
						#SavedTrip.DestinationState#
					</a>
				</td>
			</cfdefaultcase>
			<cfcase value="1">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#SavedTrip.PickupCompany#
						#SavedTrip.PickupCity#
						#SavedTrip.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#SavedTrip.DestinationCompany#
						#SavedTrip.DestinationCity#
						#SavedTrip.DestinationState#
					</a>
				</td>
			</cfcase>
			<cfcase value="2">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
							#SavedTrip.PickupFlightNumber#
							#SavedTrip.PickupAirlineTerminal#
							#SavedTrip.PickupAirportName#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#SavedTrip.DestinationCompany#
						#SavedTrip.DestinationCity#
						#SavedTrip.DestinationState#
					</a>
				</td>
			</cfcase>
			<cfcase value="3">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#"> 
						#SavedTrip.PickupCompany#
						#SavedTrip.PickupCity#
						#SavedTrip.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#"> 
						#SavedTrip.DestinationFlightNumber#
						#SavedTrip.DestinationAirlineTerminal#
						#SavedTrip.DestinationAirportName#
					</a>
				</td>
			</cfcase>
		</cfswitch>
				<td>
					<a href="incl_delete.cfm?rid=#SavedTrip.rid#&TripType=#SavedTrip.TripType#" onclick="return confirmDelete()">
						Delete
					</a>
				</td>
			</tr>
		</cfloop>
	</cfoutput>
	<cfelse>
	<tr><td colspan="5">No trips available</td></tr>
	</cfif>
</cffunction>

<!---Function for incompleted trips--->
<cffunction name="incomplete">
	<cfargument name="cuuid" required="yes">
	<cfargument name="mydatasource" required="yes">
	<cfargument name="myusername" required="yes">
	<cfargument name="mypassword" required="yes">


	<cfquery name="IncompletedReservations" datasource="#mydatasource#" username="#myUsername#" password="#myPassword#">
		SELECT * FROM TravelReservations WHERE status = 'I' AND cuuid = <cfqueryparam value="#cuuid#"> ORDER BY TimeStamp
	</cfquery>

	<cfset url = "index.cfm?process=triptype&amp;irid=" & trim(IncompletedReservations.rid) & "&amp;TripType=" & trim(IncompletedReservations.TripType)>
	<cfoutput>
		<cfloop query="IncompletedReservations">
			<tr>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#IncompletedReservations.PassengerName#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#dateFormat(IncompletedReservations.TimeStamp,"m/d/yy")#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#TimeFormat(IncompletedReservations.TimeStamp,"h:mm tt")#
					</a>
				</td>
		<cfswitch expression="#IncompletedReservations.TripType#">
			<cfdefaultcase>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#IncompletedReservations.PickupCompany#
						#IncompletedReservations.PickupCity#
						#IncompletedReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#IncompletedReservations.DestinationCompany#
						#IncompletedReservations.DestinationCity#
						#IncompletedReservations.DestinationState#
					</a>
				</td>
			</cfdefaultcase>
			<cfcase value="1">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#IncompletedReservations.PickupCompany#
						#IncompletedReservations.PickupCity#
						#IncompletedReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#IncompletedReservations.DestinationCompany#
						#IncompletedReservations.DestinationCity#
						#IncompletedReservations.DestinationState#
					</a>
				</td>
			</cfcase>
			<cfcase value="2">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#IncompletedReservations.PickupFlightNumber#
						#IncompletedReservations.PickupAirlineTerminal#
						#IncompletedReservations.PickupAirportName#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#IncompletedReservations.DestinationCompany#
						#IncompletedReservations.DestinationCity#
						#IncompletedReservations.DestinationState#
					</a>
				</td>
			</cfcase>
			<cfcase value="3">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#"> 
						#IncompletedReservations.PickupCompany#
						#IncompletedReservations.PickupCity#
						#IncompletedReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#"> 
						#IncompletedReservations.DestinationFlightNumber#
						#IncompletedReservations.DestinationAirlineTerminal#
						#IncompletedReservations.DestinationAirportName#
					</a>
				</td>
			</cfcase>
		</cfswitch>
				<td>
					<a href="incl_delete.cfm?rid=#IncompletedReservations.rid#&TripType=#IncompletedReservations.TripType#" onclick="return confirmDelete()">Delete</a>
				</td>
			</tr>
		</cfloop>
	</cfoutput>
</cffunction>

<!---Function for History--->
<cffunction name="history">
	<cfargument name="cuuid" required="yes">
	<cfargument name="mydatasource" required="yes">
	<cfargument name="myusername" required="yes">
	<cfargument name="mypassword" required="yes">
	
	<cfquery name="HistoryReservations" datasource="#mydatasource#" username="#myUsername#" password="#myPassword#">
		SELECT * FROM TravelReservations WHERE status = 'C' AND cuuid = <cfqueryparam value="#cuuid#"> AND PickupDate <= '#dateformat(now())#' ORDER BY PickupDate, PickupTime
	</cfquery>
	
	<cfset url = "index.cfm?process=summary&amp;rid=" & HistoryReservations.rid & "&amp;triptype=" & HistoryReservations.triptype>
	<cfoutput>
		<cfloop query="HistoryReservations">
			<tr>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#HistoryReservations.PassengerName#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#dateFormat(HistoryReservations.PickupDate,"mm/dd/yyyy")#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#timeFormat(PickupTime,"hh:mm tt")#
					</a>
				</td>
		<cfswitch expression="#HistoryReservations.TripType#">
			<cfdefaultcase>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#HistoryReservations.PickupCompany#
						#HistoryReservations.PickupCity#
						#HistoryReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#HistoryReservations.DestinationCompany#
						#HistoryReservations.DestinationCity#
						#HistoryReservations.DestinationState#
					</a>
				</td>
			</cfdefaultcase>
			<cfcase value="1">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#HistoryReservations.PickupCompany#
						#HistoryReservations.PickupCity#
						#HistoryReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#HistoryReservations.DestinationCompany#
						#HistoryReservations.DestinationCity#
						#HistoryReservations.DestinationState#
					</a>
				</td>
			</cfcase>
			<cfcase value="2">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#HistoryReservations.PickupFlightNumber#
						#HistoryReservations.PickupAirlineTerminal#
						#HistoryReservations.PickupAirportName#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#HistoryReservations.DestinationCompany#
						#HistoryReservations.DestinationCity#
						#HistoryReservations.DestinationState#
					</a>
				</td>
			</cfcase>
			<cfcase value="3">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#"> 
						#HistoryReservations.PickupCompany#
						#HistoryReservations.PickupCity#
						#HistoryReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#"> 
						#HistoryReservations.DestinationFlightNumber#
						#HistoryReservations.DestinationAirlineTerminal#
						#HistoryReservations.DestinationAirportName#
					</a>
				</td>
			</cfcase>
		</cfswitch>
				<td><a href="incl_delete.cfm?rid=#HistoryReservations.rid#&TripType=#HistoryReservations.TripType#" onclick="return confirmDelete()">Delete</a></td>
			</tr>
		</cfloop>
	</cfoutput>
</cffunction>

<!---Function for completed upcoming trips--->
<cffunction name="scheduled">
	<cfargument name="cuuid" required="yes">
	<cfargument name="mydatasource" required="yes">
	<cfargument name="myusername" required="yes">
	<cfargument name="mypassword" required="yes">
	
	<cfquery name="ScheduledReservations" datasource="#mydatasource#" username="#myUsername#" password="#myPassword#">
		SELECT * FROM TravelReservations WHERE status = 'C' AND cuuid = <cfqueryparam value="#cuuid#"> AND PickupDate >= '#dateformat(now())#' ORDER BY PickupDate, PickupTime
	</cfquery>
	<cfset url = "index.cfm?process=summary&amp;rid=" & ScheduledReservations.rid & "&amp;triptype=" & scheduledReservations.triptype>
	<cfoutput>
		<cfloop query="ScheduledReservations">
			<tr>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#ScheduledReservations.PassengerName#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#dateFormat(ScheduledReservations.PickupDate,"mm/dd/yyyy")#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="1">
					<a href="#trim(url)#">
						#timeFormat(PickupTime,"hh:mm tt")#
					</a>
				</td>
		<cfswitch expression="#ScheduledReservations.TripType#">
			<cfdefaultcase>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#ScheduledReservations.PickupCompany#
						#ScheduledReservations.PickupCity#
						#ScheduledReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#ScheduledReservations.DestinationCompany#
						#ScheduledReservations.DestinationCity#
						#ScheduledReservations.DestinationState#
					</a>
				</td>
			</cfdefaultcase>
			<cfcase value="1">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#ScheduledReservations.PickupCompany#
						#ScheduledReservations.PickupCity#
						#ScheduledReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#ScheduledReservations.DestinationCompany#
						#ScheduledReservations.DestinationCity#
						#ScheduledReservations.DestinationState#
					</a>
				</td>
			</cfcase>
			<cfcase value="2">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#ScheduledReservations.PickupFlightNumber#
						#ScheduledReservations.PickupAirlineTerminal#
						#ScheduledReservations.PickupAirportName#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#">
						#ScheduledReservations.DestinationCompany#
						#ScheduledReservations.DestinationCity#
						#ScheduledReservations.DestinationState#
					</a>
				</td>
			</cfcase>
			<cfcase value="3">
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#"> 
						#ScheduledReservations.PickupCompany#
						#ScheduledReservations.PickupCity#
						#ScheduledReservations.PickupState#
					</a>
				</td>
				<td style="padding-left:5px; " colspan="2">
					<a href="#trim(url)#"> 
						#ScheduledReservations.DestinationFlightNumber#
						#ScheduledReservations.DestinationAirlineTerminal#
						#ScheduledReservations.DestinationAirportName#
					</a>
				</td>
			</cfcase>
		</cfswitch>
				<td>&nbsp;</td>
			</tr>
	</cfloop>
	</cfoutput>
</cffunction>

</cfcomponent>


This post has been edited by xheartonfire43x: 02 April 2009 - 07:37 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Complex variables cannot be converted to simple ones error.

#2 sansclue  Icon User is offline

  • D.I.C Regular

Reputation: 29
  • View blog
  • Posts: 316
  • Joined: 21-November 07

Re: Complex variables cannot be converted to simple ones error.

Posted 02 April 2009 - 07:40 AM

View Postxheartonfire43x, on 2 Apr, 2009 - 06:30 AM, said:

<cfset url = "engine.cfm?formprocess=savedtrip&amp;irid=" & SavedTrip.rid>


It is probably that URL is a reserved word (ie system structure like FORM). Try using another variable name instead.
Was This Post Helpful? 0
  • +
  • -

#3 xheartonfire43x  Icon User is offline

  • D.I.C Regular

Reputation: 46
  • View blog
  • Posts: 454
  • Joined: 22-December 08

Re: Complex variables cannot be converted to simple ones error.

Posted 02 April 2009 - 08:06 AM

View Postsansclue, on 2 Apr, 2009 - 06:40 AM, said:

It is probably that URL is a reserved word (ie system structure like FORM). Try using another variable name instead.


Yeah that was it. It was trying to use the URL variables... which are complex...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1