Skip to main content
Participant
May 3, 2010
Question

checking query result for newline character

  • May 3, 2010
  • 1 reply
  • 392 views

Hi guys ,

I have a query which is called in coldfusion and the values of its volumns are set into variables

LIKE in the code segment below:

<cfquery name="divisions_models" datasource="#request.formula_dsn#">
SELECT division_code as div_cd, division_name as div_dsc,
        nvl(model_code,0) as mdl_cd, nvl(model_name,'All') as mdl_dsc
       FROM fe_mfg_lkp
      where division_code is not null
      ORDER BY div_dsc, mdl_dsc
</cfquery>

<cfset div_cds = ValueList(divisions_models.div_cd)>   
<cfset div_list = ValueList(divisions_models.div_dsc)>   
<cfset mdl_cds = ValueList(divisions_models.mdl_cd)>   
<cfset mdl_list = ValueList(divisions_models.mdl_dsc)>

i am using division models query and assigning values of them to div_cds and three other variables as shown in code.

The PROBLEM is the values from query(division_models) are sometimes returning newline character ,which i have to eliminate .

Any ideas or code examples on how to acheive it.

Thanks

    This topic has been closed for replies.

    1 reply

    Inspiring
    May 3, 2010

    After you run your query, loop through it and use Replace()  to do something about the newlines.

    strenchtAuthor
    Participant
    May 3, 2010

    Thanks Dan , but can you please explain with any code snippet or example?

    Thanks once again

    Inspiring
    May 3, 2010

    Code snippets are in the manual.  If you don't have one, the internet does and googling the tag name or, coldfusion functionname is a fast way to find the pages you need.

    You are looking for cfloop, replace, chr, and QuerySetCell.