• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

Error cannot display my list

Hi,

I want to display my array list.  

something is wrong in my code.
<CFQUERY DATASOURCE="xx" NAME="DeleteNonAssociatedImages" cachedwithin="#createTimeSpan(0,0,0,-1)#">
	Select PathImage1, PathImage2, PathImage3, PathImage4, 
	SmlPathImage1,SmlPathImage2,SmlPathImage3,SmlPathImage4  from ADS
	where (PathImage1 <> "" or PathImage2 <> "" or PathImage3 <> "" 
	or PathImage4 <> "" or SmlPathImage1 <> "" or SmlPathImage2 <> "" 
	or SmlPathImage3 <> "" or SmlPathImage4 <> "")
</CFQUERY>


 <cfif isDefined("DeleteNonAssociatedImages") and DeleteNonAssociatedImages.recordcount gt 0>

	<cfset myArray = ArrayNew(1)> 


	<cfloop query = "DeleteNonAssociatedImages"> 
		<cfset DisplayData = ArrayAppend(myArray,"#trim(listLast(PathImage1, "/"))#,#trim(listLast(PathImage2, "/"))#,#trim(listLast(PathImage3, "/"))#,#trim(listLast(PathImage4, "/"))#,#trim(listLast(SmlPathImage1, "/"))#,#trim(listLast(SmlPathImage2, "/"))#,#trim(listLast(SmlPathImage3, "/"))#,#trim(listLast(SmlPathImage4, "/"))#> 
	</cfloop> 


	<cfset myList = ArrayToList(myArray, ",")> 

<cfoutput>#myList#</cfoutput>

</cfif>

Open in new window

0
lulu50
Asked:
lulu50
  • 5
  • 3
1 Solution
 
Brijesh ChauhanStaff IT EngineerCommented:
Try this...

<CFQUERY DATASOURCE="xx" NAME="DeleteNonAssociatedImages" cachedwithin="#createTimeSpan(0,0,0,-1)#">
	Select PathImage1, PathImage2, PathImage3, PathImage4, 
	SmlPathImage1,SmlPathImage2,SmlPathImage3,SmlPathImage4  from ADS
	where (PathImage1 <> "" or PathImage2 <> "" or PathImage3 <> "" 
	or PathImage4 <> "" or SmlPathImage1 <> "" or SmlPathImage2 <> "" 
	or SmlPathImage3 <> "" or SmlPathImage4 <> "")
</CFQUERY>


 <cfif isDefined("DeleteNonAssociatedImages") and DeleteNonAssociatedImages.recordcount gt 0>

	<cfset myArray = ArrayNew(1)> 


	<cfloop query = "DeleteNonAssociatedImages"> 
		<cfset DisplayData = ArrayAppend(myArray,'#trim(listLast(PathImage1, "/"))#,#trim(listLast(PathImage2, "/"))#,#trim(listLast(PathImage3, "/"))#,#trim(listLast(PathImage4, "/"))#,#trim(listLast(SmlPathImage1, "/"))#,#trim(listLast(SmlPathImage2, "/"))#,#trim(listLast(SmlPathImage3, "/"))#,#trim(listLast(SmlPathImage4, "/"))#'> 
	</cfloop> 


	<cfset myList = ArrayToList(myArray, ",")> 

<cfoutput>#myList#</cfoutput>

</cfif>

Open in new window

0
 
lulu50Author Commented:
error


Invalid CFML construct found on line 121 at column 343.  
ColdFusion was looking at the following text:
>

The CFML compiler was processing:

an expression beginning with "ArrayAppend", on line 121, column 38.This message is usually caused by a problem in the expressions structure.
a cfset tag beginning on line 121, column 18.
a cfset tag beginning on line 121, column 18.
a cfset tag beginning on line 121, column 18.
0
 
lulu50Author Commented:
I tried this but get the same error too

<cfset DisplayData = ArrayAppend(myArray,"#trim(listLast(PathImage1, '/'))#,#trim(listLast(PathImage2, '/'))#,#trim(listLast(PathImage3, '/'))#,#trim(listLast(PathImage4, '/'))#,#trim(listLast(SmlPathImage1, '/'))#,#trim(listLast(SmlPathImage2, '/'))#,#trim(listLast(SmlPathImage3, '/'))#,#trim(listLast(SmlPathImage4, '/'))#">
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
lulu50Author Commented:
I get the same error


<cfset DisplayData = ArrayAppend(myArray,'#trim(listLast(PathImage1, "/"))#,#trim(listLast(PathImage2, "/"))#,#trim(listLast(PathImage3, "/"))#,#trim(listLast(PathImage4, "/"))#,#trim(listLast(SmlPathImage1, "/"))#,#trim(listLast(SmlPathImage2, "/"))#,#trim(listLast(SmlPathImage3, "/"))#,#trim(listLast(SmlPathImage4, "/"))#'>
0
 
Brijesh ChauhanStaff IT EngineerCommented:
Hmmm.. let us seprate the list out.. can you try this one, I think we are missing on ')' in above code..


<CFQUERY DATASOURCE="xx" NAME="DeleteNonAssociatedImages" cachedwithin="#createTimeSpan(0,0,0,-1)#">
	Select PathImage1, PathImage2, PathImage3, PathImage4, 
	SmlPathImage1,SmlPathImage2,SmlPathImage3,SmlPathImage4  from ADS
	where (PathImage1 <> "" or PathImage2 <> "" or PathImage3 <> "" 
	or PathImage4 <> "" or SmlPathImage1 <> "" or SmlPathImage2 <> "" 
	or SmlPathImage3 <> "" or SmlPathImage4 <> "")
</CFQUERY>


 <cfif isDefined("DeleteNonAssociatedImages") and DeleteNonAssociatedImages.recordcount gt 0>

	<cfset myArray = ArrayNew(1)> 


	<cfloop query = "DeleteNonAssociatedImages"> 
    	<cfset imglist = '#trim(listLast(PathImage1, "/"))#' & ',' & '#trim(listLast(PathImage2, "/"))#' & ',' & '#trim(listLast(PathImage3, "/"))#' & ',' & '#trim(listLast(PathImage4, "/"))#' & ',' & '#trim(listLast(SmlPathImage1, "/"))#' & ',' & '#trim(listLast(SmlPathImage2, "/"))#' & ',' & '#trim(listLast(SmlPathImage3, "/"))#' & ',' & '#trim(listLast(SmlPathImage4, "/"))#' />
		<cfset DisplayData = ArrayAppend(myArray, "#imgList#")> 
	</cfloop> 


	<cfset myList = ArrayToList(myArray, ",")> 

<cfoutput>#myList#</cfoutput>

</cfif>

Open in new window

0
 
Brijesh ChauhanStaff IT EngineerCommented:
This is your original code.. the last ')' closing bracket is missing..

<CFQUERY DATASOURCE="xx" NAME="DeleteNonAssociatedImages" cachedwithin="#createTimeSpan(0,0,0,-1)#">
	Select PathImage1, PathImage2, PathImage3, PathImage4, 
	SmlPathImage1,SmlPathImage2,SmlPathImage3,SmlPathImage4  from ADS
	where (PathImage1 <> "" or PathImage2 <> "" or PathImage3 <> "" 
	or PathImage4 <> "" or SmlPathImage1 <> "" or SmlPathImage2 <> "" 
	or SmlPathImage3 <> "" or SmlPathImage4 <> "")
</CFQUERY>


 <cfif isDefined("DeleteNonAssociatedImages") and DeleteNonAssociatedImages.recordcount gt 0>

	<cfset myArray = ArrayNew(1)> 


	<cfloop query = "DeleteNonAssociatedImages"> 
		<cfset DisplayData = ArrayAppend(myArray,'#trim(listLast(PathImage1, "/"))#,#trim(listLast(PathImage2, "/"))#,#trim(listLast(PathImage3, "/"))#,#trim(listLast(PathImage4, "/"))#,#trim(listLast(SmlPathImage1, "/"))#,#trim(listLast(SmlPathImage2, "/"))#,#trim(listLast(SmlPathImage3, "/"))#,#trim(listLast(SmlPathImage4, "/"))#')> 
	</cfloop> 


	<cfset myList = ArrayToList(myArray, ",")> 

<cfoutput>#myList#</cfoutput>

</cfif>

Open in new window

0
 
lulu50Author Commented:
ah, great!!!!

thank you
0
 
lulu50Author Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now