Skip to main content
Inspiring
May 2, 2019
Question

Coldfusion Coding Issue

  • May 2, 2019
  • 2 replies
  • 390 views

Hello I'm not the greatest at Coldfusion I'm trying to get it to look at a field in our sql table and if it's not black to print "f:" with the stockas info. I also need it to look at another field crossfile and when it's true (1) to change the upc label to say "xf:" instead of "f:". My issue so far is I can get it to print the cross file fine, but when file as is filled out and crossfile is false (0) it won't print out "f:" it's just blank like it is when nothing is under stockas. Here's part of my coding that it effects:

<cfquery name="qPrt" Datasource="#Data.Datasource#" >

    SELECT    p.ItemID, p.UPC, p.vendorID, p.SKU,   p.StockAs, p.Artist, p.Title, p.RetailPrice, p.releaseDate, p.Attribute2

            , g.generalCategory, p.Crossfile

    FROM    Item p

      LEFT JOIN GeneralCategory g ON p.GeneralCategory = g.generalCategoryID

    Where p.ItemID = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.PID#" >

</cfquery>

<cfif #qPrt.StockAS# IS NOT ""><cfset lchar = 10><cfelse><cfset lchar = 25></cfif>

    <span style="font-size:11px; font-weight:bold;">#Left(qPrt.Artist,lchar)#<cfif #qPrt.StockAS# IS NOT "" and #qPrt.Crossfile# eq 0>-F: #Left(qPrt.StockAS,15)#</cfif><cfif #qPrt.StockAS# IS NOT "" and #qPrt.Crossfile# eq 1>-XF: #Left(qPrt.StockAS,15)#</cfif></span><br>

With the coding above it will print a XF:, but if it's only a stockas (f:) it will be blank. What do I need to change in <cfif #qPrt.StockAS# IS NOT "" and #qPrt.Crossfile# eq 0> in order to get it to print with the f:.

Thanks

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
May 3, 2019

Could you show all of the code including the cfoutput tags?

EddieLotter
Inspiring
May 2, 2019

I don't think this is a ColdFusion issue. It's a logic issue.

How would you structure your logic in a language that you are more familiar with, for example C++?