# Coldfusion:problems inserting values of comma seperated list in database

**URL:** <https://forum.kirupa.com/t/coldfusion-problems-inserting-values-of-comma-seperated-list-in-database/241460>\
**Category:** programming\
**Created:** [October 14, 2007, 11:46am UTC](https://forum.kirupa.com/t/coldfusion-problems-inserting-values-of-comma-seperated-list-in-database/241460 "2007-10-14T11:46:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)\
**Post date:** [October 14, 2007, 11:46am UTC](https://forum.kirupa.com/t/coldfusion-problems-inserting-values-of-comma-seperated-list-in-database/241460/1 "2007-10-14T11:46:44Z")

</div>

Can anybody explain how I get the values of a comma seperated list in a database field. The comma seperated lis is created by choice from different check boxes:

```auto
<cfif isDefined ('form.beach')>
<cfset form.beach = ' beach view'>
<cfelse>
<cfset form.beach = ''>
</cfif>
<cfif isDefined ('form.countryside')>
<cfset form.countryside = ' countryside'>
<cfelse>
<cfset form.countryside = ''>
</cfif>
<cfif isDefined ('form.mountain')>
<cfset form.mountain = ' mountain'>
<cfelse>
<cfset form.mountain = ''>
</cfif>
<cfscript>
 list = arrayNew(1);
 list[1] = "#form.beach#";
 list[2] = "#form.countryside#";
 list[3] = "#form.mountain#";
</cfscript>
<cfscript>    
<cfset list =listToArray(form.beach&','&countryside&','&form.mountain);>
</cfscript>

```

But when I use #list# in my insert statement I get the following error:

```auto
Complex object types cannot be converted to simple values.  
The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values. 
The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a <CFIF> tag. This was possible in ColdFusion 2.0 but creates an error in later versions.

```

What am i doing wrong?
