Using CF9 and have a pretty basic html cfgrid that returns results from a SQL query.
There are just two columns in the grid: "ID" and "IDType".
I'm looking to see if there's a way to implement some logic so that when I certain IDType shows up, the value in the ID field becomes the key value in a hyperlink.
Example: IF IDType = "web", and the ID is "1234", the value inside the ID field would show up as http:/www.website.com/1234.html (or...better: just show up as "1234" but be hyperlink-enabled to go to the aforementioned site.)
If the IDType is not (for example) "web", then the value just shows up as a regular cell value (text).
<cfgrid
name="idGrid"
title="Related IDs"
query="get_IDs"
format="html"
>
<cfgridcolumn name="ID" header="ID" />
<cfgridcolumn name="IDType" header="ID Source" />
</cfgrid>
One way to do this is you can generate and append a column to your query using the queryColumnAdd() function, put your link in the cell, and then push the modified query it to the cfgrid.
The link will render and you can click on it!
If I may pseudo code.. first write your normal query
<cfquery name = "myQuery" datasource = "myCFDatasource">
SELECT ID, field1, field2, field3
FROM aTable
</cfquery>
Next, we add your link column onto it..
<cfset queryAddColumn(myQuery, "Link", ArrayNew(1)) />
<cfloop query="myQuery">
<cfset querySetCell(myQuery, "Link", "http://www.mysite.com/some/index.cfm?ID=#myQuery.ID#"), myQuery.currentRow) />
</cfloop>
Then, you can take your modified query myQuery and submit it into your cfgrid like you did above.
Hope that helps get you on the right path.., worked well for me the last time I used it!