Solved

If Row has a value, then display URL

Posted on 2003-11-30
4
140 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Two nodes for updates and forwarding 8 51
Coldfusion Datefield problem 2 137
SCCM vs Windows server 5 90
Web Site Hosting 10 102
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

751 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