Skip to main content
Participating Frequently
July 21, 2011
Question

len() function

  • July 21, 2011
  • 2 replies
  • 2670 views

Hi all,

Am new to CFM and my client asked me to make a small change in his website. So, i identified the page and did a small change. But the change is not working. I've attached the file for reference.

In that file, see the commentd line nos : 139-147

<!---<cfset new="#dato#">

        <cfset new_id="">

        <cfset new_id1="">

        <cfif len(new) lt 6>

        <cfset new_id = '00000'&new>

        <cfset new_id1 = right(new_id,6)>

        <cfelse>

        <cfset new_id1 = new>

        </cfif>--->

and the line no - 148 is having the partial query as a string.

<cfset mani_querybusca3 = "and c.IdCliente like '%#new_id1 #%' ">

But whats the value am generating in the 139-147 lines is not coming in that 148th line.

For Eg:

Can anyone help me to solve this problem?

This topic has been closed for replies.

2 replies

Inspiring
July 22, 2011

You are never too new to learn how to troubleshoot.  A method I use frequently is to look at my data using the cfdump tag.

For your situation, put this tag

<cfdump var="#dato#">

right before the block of code you posted.

Then, as you get to your if/else logic, do this sort of thing to see what is happening.

<cfif something>

yes

<cfelse>

no

<cfdump the data you were working with>

</cfif>

Participating Frequently
July 22, 2011

the variable "dato" is in query page. Its not in the display page. So, how can i see the cfdump value of "dato" variable? I put cfdump in query page and tried to view that. But i cant.

Inspiring
July 22, 2011

If you can do this:

<cfset new="#dato#">

You can do this:

<cfdump var="#dato#">

If necessary, add an abort attribute.

Inspiring
July 21, 2011

Could that is because the lines are commented out and not executing? Your question is not very clear. You don't say what you changed, did you add the comment tags?

Participating Frequently
July 21, 2011

Sorry, I forgot to remove the comments at the time of posting.

Originally there is no comment in the page.

Inspiring
July 21, 2011

Actually you may have been on the right track, put the comments

back, you don't need any of that (ummmmm code)...

try this:

<cfset mani_querybusca3 = "and c.IdCliente like '%#Right("000000"&Trim(dato),6)#%' ">