etherealz
asked on
display and hide field value
how can i display the column value and hide it for other rows?
e.g.
productNo name partNo partDescription
100 abc 01 light
02 bulb
03 plug
101 def 01 box
02 paper
as u can see the productno and name are not listed for the other rows. how do i do that in coldfusion language?
this is my attempt:
<cfoutput query="showProductComponen ts">
<tr>
<cfif productNo1 is "">
<cfset productNo1 = #showComponents.productNo# >
<cfelse>
<cfset productNo2 = #showComponents.productNo# >
</cfif>
<td>#productNo#</td>
<td>#showComponents.Name#< /td>
<td>#showComponents.partNo #</td>
<td>#showComponents.descri ption#</td >
</tr>
</cfoutput>
e.g.
productNo name partNo partDescription
100 abc 01 light
02 bulb
03 plug
101 def 01 box
02 paper
as u can see the productno and name are not listed for the other rows. how do i do that in coldfusion language?
this is my attempt:
<cfoutput query="showProductComponen
<tr>
<cfif productNo1 is "">
<cfset productNo1 = #showComponents.productNo#
<cfelse>
<cfset productNo2 = #showComponents.productNo#
</cfif>
<td>#productNo#</td>
<td>#showComponents.Name#<
<td>#showComponents.partNo
<td>#showComponents.descri
</tr>
</cfoutput>
Hi etherealz,
<cfset lastProduct = "" />
<cfoutput query="showProductComponen ts">
<tr>
<td>
<cfif showComonents.partNo neq lastProduct>
#showComonents.partNo#
<cfelse>
</cfif>
</td>
<td>
<cfif showComonents.partNo neq lastProduct>
#showComonents.Name#
<cfelse>
</cfif>
</td>
<td>#showComponents.partNo #</td>
<td>#showComponents.descri ption#</td >
</tr>
<cfset lastProduct = showComponents.PartNo />
</cfoutput>
Regards
Plucka
<cfset lastProduct = "" />
<cfoutput query="showProductComponen
<tr>
<td>
<cfif showComonents.partNo neq lastProduct>
#showComonents.partNo#
<cfelse>
</cfif>
</td>
<td>
<cfif showComonents.partNo neq lastProduct>
#showComonents.Name#
<cfelse>
</cfif>
</td>
<td>#showComponents.partNo
<td>#showComponents.descri
</tr>
<cfset lastProduct = showComponents.PartNo />
</cfoutput>
Regards
Plucka
ASKER
plucka,
your codes don't work
your codes don't work
<cfset lastProduct = "" />
<cfoutput query="showProductComponen ts">
<tr>
<cfif productNo neq lastProduct>
<td>#partNo#</td>
<td>#Name#</td>
<cfelse>
<td> </td>
<td> </td>
</cfif>
<td>#partNo#</td>
<td>#partDescription#</td>
</tr>
<cfset lastProduct = productNo />
</cfoutput>
<cfoutput query="showProductComponen
<tr>
<cfif productNo neq lastProduct>
<td>#partNo#</td>
<td>#Name#</td>
<cfelse>
<td> </td>
<td> </td>
</cfif>
<td>#partNo#</td>
<td>#partDescription#</td>
</tr>
<cfset lastProduct = productNo />
</cfoutput>
didn't like my post?
etherealz,
I just notices your query name doesn't match your field names, try this as you don't need to specify query names within a cfoutput of a query.
<cfset lastProduct = "" />
<cfoutput query="showProductComponen ts">
<tr>
<td>
<cfif partNo neq lastProduct>
#partNo#
<cfelse>
</cfif>
</td>
<td>
<cfif partNo neq lastProduct>
#Name#
<cfelse>
</cfif>
</td>
<td>#partNo#</td>
<td>#description#</td>
</tr>
<cfset lastProduct = PartNo />
</cfoutput>
Regards
Plucka
I just notices your query name doesn't match your field names, try this as you don't need to specify query names within a cfoutput of a query.
<cfset lastProduct = "" />
<cfoutput query="showProductComponen
<tr>
<td>
<cfif partNo neq lastProduct>
#partNo#
<cfelse>
</cfif>
</td>
<td>
<cfif partNo neq lastProduct>
#Name#
<cfelse>
</cfif>
</td>
<td>#partNo#</td>
<td>#description#</td>
</tr>
<cfset lastProduct = PartNo />
</cfoutput>
Regards
Plucka
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<cfoutput query="showProductComponen
<CFSET headerrow = 1>
<tr>
<td>#productNo#</td>
<td>#Name#</td>
<CFOUTPUT>
<CFIF headerrow neq 1><TR><TD></td><TD></td></
<td>#partNo#</td>
<td>#description#</td>
</TR>
<CFSET headerrow = 0>
</cfoutput>
</cfoutput>