how can i separate numeric and non-numeric values ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sulemankhan
    New Member
    • Jun 2013
    • 1

    how can i separate numeric and non-numeric values ?

    hi,
    I am working on survey App in this i have to collect answers i have one problem while saving multiplechoice with other type of question.
    Code:
    <cfcase value="multiplechoicemultiother">
    
    	<cfif StructkeyExists(answer,"answerValue") AND NOT isNumeric(answer.answervalue) AND Find("other,",answer.answervalue)>
    		<cfquery name="insertresult">
    		INSERT INTO results (fkquestionid, fksurveyresultsid, other)
    		VALUES (
    		<cfqueryparam cfsqltype="cf_sql_int" value="#answer.questionid#">
    		,<cfqueryparam cfsqltype="cf_sql_int" value="#getResultid.id#">
    		,<cfqueryparam cfsqltype="cf_sql_varchar" value="#answer.answervalue#">
    		)
    		</cfquery>    
    	<cfelse>
    
    		<cfloop list="#answer.answervalue#" index="answervalue"> 
    		<cfquery name="insertresult">
    		INSERT INTO results (fkquestionid, fksurveyresultsid, fkanswerId)
    		VALUES (
    		<cfqueryparam cfsqltype="cf_sql_bigint" value="#answer.questionid#">
    		,<cfqueryparam cfsqltype="cf_sql_bigint" value="#getResultId.id#">
    		,<cfqueryparam cfsqltype="cf_sql_varchar" value="#answerValue#" list="true">
    		)
    		</cfquery>
    		</cfloop>
    	</cfif>
    </cfcase>
    here while submitting answers with other it stores the ids and text together in other column. I would like to know how shall i have to separate numeric and non numeric values and save it in their respective column in database.
    Last edited by acoder; Jun 18 '13, 10:56 PM.
Working...