Solved

If Row has a value, then display URL

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now