4 Replies Latest reply on Apr 27, 2006 5:29 AM by Iceborer

    Altering Returned Data

    hlywd7
      I have a query that returns titles. Some of the tiles are single words (example: Business Law) and some of them contain a "/" in the title Example: Criminal Law/Child Law. I would like to be able to find all the instances of the titles that contain a / and format the output so they appear as seperate items.

      Here is what I would like the output to look like:
      Business Law
      Criminal Law
      Child Law
        • 1. Re: Altering Returned Data
          Dan Bracuk Level 5
          Use the replace function. Details are in the cfml reference manual. If you don't have one, the internet does.
          • 2. Re: Altering Returned Data
            hlywd7 Level 1
            The output is in a loop so how would I include that in the loop. Here is what the code looks like

            <cfquery dbtype="query" name="getsection">
            Select entity, formatted_name, entity_type
            from qCustomerEntities
            Where entity_type = 'S'
            order by formatted_name
            </cfquery>

            <cfloop query="getsection">
            <cfoutput>#getsection.formatted_name#</cfoutput>
            </cfloop>
            • 3. Re: Altering Returned Data
              Dan Bracuk Level 5
              You use it inside a loop the same way you use it outside a loop. Did the example in the manual not help?

              By the way, your loop won't work properly because you are not specifying a row number. You would be better off using the query attribute of cfoutput instead.
              • 4. Re: Altering Returned Data
                Iceborer
                Having read what you said and comparing it what Dan is offering to help you, I'm not sure I understand what you're trying to accomplish, but I won't let that stand in the way of me offering a solution:) I added a couple of <cfdump> tags just to show things as they build up.