Solved

If Row has a value, then display URL

Posted on 2003-11-30
4
141 Views
Last Modified: 2013-12-24
I want to do this.

Show rows from my table dynamically. I know how to do this.

If the current record being shown does not have an empty value in the Description column, then show the words DESC.

DESC will be a link that opens a new window showing only that particular records Description field.

<TABLE WIDTH="99%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
  <TR>
    <TD>ID</TD>
    <TD>Type</TD>
    <TD>Description</TD>
  </TR>
  <cfoutput QUERY="cars">
  <TR>
 
    <TD>#ID#</TD>
    <TD>#VehicleType#</TD>
    <TD>#Description#</TD>
  </TR></cfoutput>
</TABLE>
0
Comment
Question by:zakirdavis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:jyokum
ID: 9848208
<cfoutput QUERY="cars">
  <TR>
    <TD>#ID#</TD>
    <TD>#VehicleType#</TD>
    <TD>
    <cfif len(cars.description)>
      <a href="whatever.cfm?ID=#cars.ID#">DESC</a>
    </cfif>
    </TD>
  </TR>
</cfoutput>
0
 

Author Comment

by:zakirdavis
ID: 9848251
For the page whatever.cfm,

In order to be able to reuse this page for my other tables, i think i will want to pass what table it is coming from. I have a hidden input field for this traveling from the original page that states what table it is coming from.

ex. on my cars.cfm page, i created a hidden field (TYPEFLAG) with value=cars.
on trucks.cfm page, i created a hidden field (TYPEFLAG) with  value=trucks

I know i will have to have a CFQUERY to talk to the DB (on the whatever.cfm page), but how will i take the value from the URL and use it in my CFQUERY?

??
<CFQUERY name="allVehicles" datasource="Vehicles">
SELECT Desc FROM #TYPEFLAG# Where ID IS url.whatever
</CFQUERY>
??

Also, how would i append more than one value to the url?

??
<a href="whatever.cfm?ID=#cars.ID#"&Table=#TYPEFLAG#>DESC</a>
??
0
 
LVL 12

Accepted Solution

by:
jyokum earned 500 total points
ID: 9848253
<a href="whatever.cfm?ID=#cars.ID#&Table=#TYPEFLAG#">DESC</a>

then on whatever.cfm

<CFQUERY name="allVehicles" datasource="Vehicles">
SELECT Desc FROM #url.table# Where ID = <cfqueryparam value="#url.ID#" cfsqltype="cf_sql_numeric">
</CFQUERY>
0
 

Author Comment

by:zakirdavis
ID: 9848407
Thank you so very much. You are a big help!
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
What You Need to Know when Searching for a Webhost Provider
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question