[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

display and hide field value

Posted on 2005-04-21
7
Medium Priority
?
181 Views
Last Modified: 2013-12-24
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="showProductComponents">
         <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.description#</td>
               
         </tr>
      </cfoutput>
0
Comment
Question by:etherealz
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 15

Expert Comment

by:danrosenthal
ID: 13839414
how about this:

<cfoutput query="showProductComponents" group="productNo">
      <CFSET headerrow = 1>
      <tr>
            <td>#productNo#</td>
            <td>#Name#</td>
      <CFOUTPUT>
            <CFIF headerrow neq 1><TR><TD></td><TD></td></cfif>
                  <td>#partNo#</td>
                  <td>#description#</td>
            </TR>
            <CFSET headerrow = 0>
      </cfoutput>
</cfoutput>
0
 
LVL 18

Expert Comment

by:Plucka
ID: 13839415
Hi etherealz,

    <cfset lastProduct = "" />
    <cfoutput query="showProductComponents">
        <tr>
            <td>
                <cfif showComonents.partNo neq lastProduct>
                    #showComonents.partNo#
                <cfelse>
                    &nbsp;
                </cfif>
            </td>
            <td>
                <cfif showComonents.partNo neq lastProduct>
                    #showComonents.Name#
                <cfelse>
                    &nbsp;
                </cfif>
            </td>
            <td>#showComponents.partNo#</td>
            <td>#showComponents.description#</td>
        </tr>
        <cfset lastProduct = showComponents.PartNo />    
    </cfoutput>


Regards
Plucka
0
 

Author Comment

by:etherealz
ID: 13839523
plucka,

your codes don't work
0
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

 
LVL 1

Expert Comment

by:dillusion13
ID: 13839607
<cfset lastProduct = "" />
<cfoutput query="showProductComponents">
    <tr>
        <cfif productNo neq lastProduct>
        <td>#partNo#</td>
        <td>#Name#</td>
        <cfelse>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        </cfif>
        <td>#partNo#</td>
        <td>#partDescription#</td>
    </tr>
    <cfset lastProduct = productNo />    
</cfoutput>
0
 
LVL 15

Expert Comment

by:danrosenthal
ID: 13839609
didn't like my post?
0
 
LVL 18

Expert Comment

by:Plucka
ID: 13839613
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="showProductComponents">
        <tr>
            <td>
                <cfif partNo neq lastProduct>
                    #partNo#
                <cfelse>
                    &nbsp;
                </cfif>
            </td>
            <td>
                <cfif partNo neq lastProduct>
                    #Name#
                <cfelse>
                    &nbsp;
                </cfif>
            </td>
            <td>#partNo#</td>
            <td>#description#</td>
        </tr>
        <cfset lastProduct = PartNo />    
    </cfoutput>

Regards
Plucka
0
 
LVL 1

Accepted Solution

by:
dillusion13 earned 200 total points
ID: 13839624
correction on mine,  but all available choices should work

<cfset lastProduct = "" />
<cfoutput query="showProductComponents">
    <tr>
        <cfif productNo neq lastProduct>
        <td>#productNo#</td>
        <td>#Name#</td>
        <cfelse>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        </cfif>
        <td>#partNo#</td>
        <td>#partDescription#</td>
    </tr>
    <cfset lastProduct = productNo />    
</cfoutput>
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
What You Need to Know when Searching for a Webhost Provider
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month19 days, 10 hours left to enroll

872 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