2 Replies Latest reply on Jan 23, 2008 7:51 AM by ClayD

    Need Help Displaying Query

      I am having problems with this, I need to re-write this into 3 different routes the CFIF can take. Currently this works because the query only returns 9 records, they are being displayed as 3 rows with 3 columns. I need to re-write and have it where if the record count is LT9 to only have the output be on 2 columns with 3 rows....and if the count is LT6 then i only want 1 row with 3 columns. I am having problems figuring out how to modify this code to accomplish this task. Any help would be greeeeeeeeeeeeat.

      <cfif alsobought_counter LTE 9>
      <cfif (prodCount+(detailsColCount-1)) MOD detailsColCount EQ 0><div class="clearfix"></cfif>
      <div class="productThumbCont">
      <cfset product_link = link("product", alsoBought_product_id, product_title)>
      <div class="productThumbImg">
      <a href="#product_link#" class="picksLink" title="#linktitle#"><img src="#cfimage[alsobought_counter].thumb.path#" alt="" border="0"
      tooltip="#alsoBought_product_id#" />
      <cfif len(trim(qryAlso_Bought.is_ondemand)) and qryrelated_products.is_ondemand EQ 1 AND qryAlso_Bought.is_disabled
      NEQ 1 AND request.allowVOD eq 1><div class="on-demand-call-out"
      url(../skins/graphics/btns/ondemand-overlay.gif) 0 0
      no-repeat;width:79px;height:22px;filter:alpha(opacity=80);-moz-opacity:.80;opacity:.80;">< /div></cfif></a>
      <div class="productThumbTitle">
      <a href="#product_link#" class="picksLink"
      title="#linktitle#">#product_title#<cfif len(trim(extendedTitle))>
      <!--- <cfif len(trim(qryAlso_Bought.hotmovies_id)) AND
      qryAlso_Bought.is_disabled NEQ 1 AND request.allowVOD eq 1><div
      src="../skins/graphics/btns/ondemand.gif" alt="Available On-Demand"
      border="0" /></div></cfif> --->
      <cfif prodCount MOD detailsColCount EQ 0></div></cfif>
      <cfset prodCount = IncrementValue(prodCount)>
      <cfset alsobought_counter = IncrementValue(alsobought_counter)>
      <cfif (prodCount-1) MOD detailsColCount NEQ 0></div></cfif>
      </div> Text
        • 1. Re: Need Help Displaying Query
          Dan Bracuk Level 5
          After you run your query, look at the record count. Run all the if/else logic you have to to determine the number of columns you want. Don't worry about the number of rows, that will take care of itself.

          Once you have the number of columns figured out, output your data as simply as possible, no style tags, no links, just data. Use the modulus operator to decide when to start a new row.

          Once you've accomplished that, start adding the rest of your stuff.
          • 2. Re: Need Help Displaying Query
            ClayD Level 1
            I think that's my issue, I don't understand where the rows and columns are really coming from.