I am trying to run an SQL query using an ArraytoList function, and I can't get the delimiters to set correctly. Let me explain...
I have a form where the users enter in their selections and submit the page. On the next page, the selected items are in an array. I want to run an SQL query based on what items were selected from the previous page. So, to run the query, I want to set my array to a list.
The problem I am having lies in how the delimiter is set. SQL needs to have the ID's set up like: '1', '2', '3', etc. I can't set my delimeter to disply the ID as required. Here are the delimeters I have set and what the results are:
ArrayToList(myArrayList, "''"
: '1''''2'
ArrayToList(myArrayList, "'"
: '1''2'
ArrayToList(myArrayList, ",'"
: '1,''2'
ArrayToList(myArrayList, "',"
: '1'',2'
ArrayToList(myArrayList, "','"
: '1'',''2'
Any ideas on how to set my delimiter so that the output is like: '1','2'? Any help is much appreciated. Thanks!
I have a form where the users enter in their selections and submit the page. On the next page, the selected items are in an array. I want to run an SQL query based on what items were selected from the previous page. So, to run the query, I want to set my array to a list.
Code:
<CFSET List = ArrayToList(myArrayList, "''")>
<CFQUERY NAME="qStPick" DBTYPE="Oracle80">
SELECT ID
FROM NAMES.ID
WHERE ID IN ('#List#')
</CFQUERY>
ArrayToList(myArrayList, "''"
ArrayToList(myArrayList, "'"
ArrayToList(myArrayList, ",'"
ArrayToList(myArrayList, "',"
ArrayToList(myArrayList, "','"
Any ideas on how to set my delimiter so that the output is like: '1','2'? Any help is much appreciated. Thanks!