Solved

(Help please) Adding an ad icon to my parent and child list

Posted on 2014-03-25
8
247 Views
Last Modified: 2014-03-25
Hi,

I have a parent and child list that I need to add an (ad icon) to the list.

the output should look just like in the image.  If the record is a child the ad icon should be added to the end of the list. If the record is a parent the ad icon should be added right after it.  

I need your help please.

Thanks,
Lulu



<cfif val(QSearchResult.ParentIssueID)> 
 <!-- //Child Row -->
 <tr class="bg2row">
   <td style="padding-left:20px;">#QSearchResult.issueID#</td>
 <td>#QSearchResult.ticketNumber#</td>
 <td>#QSearchResult.Category#</td>
 <td>#QSearchResult.TitleOfIssue#</td>
 <td>#QSearchResult.Status#</td>
  <td>#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
    <td><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
    <img src="images/view.png" alt="View Sub Issue" />
    </td>
    </tr>  
 <cfelse>
<!-- //Parent Row -->
 <tr class="bgrow">
   <td style="font-weight:bold;padding-left:5px;">#QSearchResult.issueID#</td>
 <td style="font-weight:bold;">#QSearchResult.TicketNumber#</td>
 <td style="font-weight:bold;">#QSearchResult.Category#</td>
 <td style="font-weight:bold;">#QSearchResult.TitleOfIssue#</td>
 <td style="font-weight:bold;">#QSearchResult.Status#</td>
  <td style="font-weight:bold;">#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
  <td style="color:dark blue;"><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
  <img src="images/view.png" alt="View Sub Issue" />
  </td>
  </tr>
  
 </cfif>

Open in new window




 <tr class="bg2row">
    <td colspan="6" style="text-align:right;">
      <a href="LogEntry.cfm?AID=#QSearchResult.ParentIssueID#"><img src="images/add.png" alt="Add Sub Issue" /></a>
    </td>
    <td>
    </td>
    </tr>

Open in new window


ad
0
Comment
Question by:lulu50
  • 5
  • 3
8 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 39953359
Hi Lulu,
I know it seems complex to figure out the pattern of when to display the icon, after a parent if no children (how do you know if there are children?)  and after the last child, (how do you know if its the last child?)

But think of it this way.   The icon appears BEFORE every parent record.   So, that's a much easier way to think of it when coding.  Before drawing a parent record, you need to show this Add Icon from the previous set of records regardless of whether there are children or not.

The exception is, that you don't want to show it for the first parent record (because there is nothing before it).    The only challenge then is to know what the ID is of the ID before the parent you are drawing.  So we will just put in a variable to remember the previous ID.

Check this out...

<cfif val(QSearchResult.ParentIssueID)> 
 <!-- //Child Row -->
 <tr class="bg2row">
    <td style="padding-left:20px;">#QSearchResult.issueID#</td>
    <td>#QSearchResult.ticketNumber#</td>
    <td>#QSearchResult.Category#</td>
    <td>#QSearchResult.TitleOfIssue#</td>
    <td>#QSearchResult.Status#</td>
    <td>#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
    <td>
	  <a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
      <img src="images/view.png" alt="View Sub Issue" />
    </td>
  </tr>  
<cfelse>
<!-- //Parent Row -->
 <cfif QSearchResult.currentRow gt 1 and val(previousParentIssueID)>
 <tr>
   <td colspan="6">&nbsp;</td>
   <td><a href="AddChild.cfm?EID=#previousParentIssueID#"><img src="images/AddChild.png" alt="Add Child" /></a>
 </tr>
 </cfif>
 <tr class="bgrow">
	 <td style="font-weight:bold;padding-left:5px;">#QSearchResult.issueID#</td>
	 <td style="font-weight:bold;">#QSearchResult.TicketNumber#</td>
	 <td style="font-weight:bold;">#QSearchResult.Category#</td>
	 <td style="font-weight:bold;">#QSearchResult.TitleOfIssue#</td>
	 <td style="font-weight:bold;">#QSearchResult.Status#</td>
	  <td style="font-weight:bold;">#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
	  <td style="color:dark blue;"><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
	  <img src="images/view.png" alt="View Sub Issue" />
	  </td>
  </tr>
</cfif>
<cfset previousParentIssueID = QSearchResult.ParentIssueID>

Open in new window

0
 
LVL 39

Expert Comment

by:gdemaria
ID: 39953368
As a side note, I also think the page would look good if you just place the icon on the same line as the parent (with the other two icons).   That would save you a lot of rows that are there just for the Add icon.   BUt that's up to you and your clients... just my 2 cents.
0
 

Author Comment

by:lulu50
ID: 39953825
gdemaria,

I made the changes but, I only able to have one add in one of the parents.

Yes, I agree I should not have an extra row for the ad

<cfoutput query="QSearchResult" startrow="#start_record#" maxrows="#records_per_page#">

 <cfif val(QSearchResult.ParentIssueID)> 
 <!-- //Child Row -->
 <tr class="bg2row">
   <td style="padding-left:20px;">#QSearchResult.issueID#</td>
 <td>#QSearchResult.ticketNumber#</td>
 <td>#QSearchResult.Category#</td>
 <td>#QSearchResult.TitleOfIssue#</td>
 <td>#QSearchResult.Status#</td>
  <td>#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
    <td><a href="LogEntry.cfm?TechType=#QSearchResult.CategoryTypeID#&ID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
    <img src="images/view.png" alt="View Sub Issue" />
    </td>
    </tr>  
 <cfelse>
 <tr class="bgrow">
	 <td style="font-weight:bold;padding-left:5px;">#QSearchResult.issueID#</td>
	 <td style="font-weight:bold;">#QSearchResult.TicketNumber#</td>
	 <td style="font-weight:bold;">#QSearchResult.Category#</td>
	 <td style="font-weight:bold;">#QSearchResult.TitleOfIssue#</td>
	 <td style="font-weight:bold;">#QSearchResult.Status#</td>
	  <td style="font-weight:bold;">#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
	  <td style="color:dark blue;"><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
	  <img src="images/view.png" alt="View Sub Issue" />
      <cfif QSearchResult.currentRow gt 1 and val(previousParentIssueID)>
      <a href="AddChild.cfm?EID=#previousParentIssueID#"><img src="images/add.png" alt="Add Child" /></a>
      </cfif>
      
	  </td>
  </tr>
</cfif>
<cfset previousParentIssueID = QSearchResult.ParentIssueID> 

 
</cfoutput>

Open in new window




as
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:lulu50
ID: 39953853
I got it!!!!!!!!!!
0
 

Author Comment

by:lulu50
ID: 39953872
It's working!!!!!!!!!!!!

this is what I did.

<cfset previousParentIssueID = QSearchResult.ParentIssueID> 
<cfoutput query="QSearchResult" startrow="#start_record#" maxrows="#records_per_page#">

 <cfif val(QSearchResult.ParentIssueID)> 
 <!-- //Child Row -->
 <tr class="bg2row">
   <td style="padding-left:20px;">#QSearchResult.issueID#</td>
 <td>#QSearchResult.ticketNumber#</td>
 <td>#QSearchResult.Category#</td>
 <td>#QSearchResult.TitleOfIssue#</td>
 <td>#QSearchResult.Status#</td>
  <td>#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
    <td><a href="LogEntry.cfm?TechType=#QSearchResult.CategoryTypeID#&ID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
    <img src="images/view.png" alt="View Sub Issue" />
    </td>
    </tr>  
 <cfelse>
 <tr class="bgrow">
	 <td style="font-weight:bold;padding-left:5px;">#QSearchResult.issueID#</td>
	 <td style="font-weight:bold;">#QSearchResult.TicketNumber#</td>
	 <td style="font-weight:bold;">#QSearchResult.Category#</td>
	 <td style="font-weight:bold;">#QSearchResult.TitleOfIssue#</td>
	 <td style="font-weight:bold;">#QSearchResult.Status#</td>
	  <td style="font-weight:bold;">#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
	  <td style="color:dark blue;"><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
	  <img src="images/view.png" alt="View Sub Issue" />
                 <cfif not val(previousParentIssueID)>
      <a href="AddChild.cfm?EID=#QSearchResult.issueID#"><img src="images/add.png" alt="Add Child" /></a>
      </cfif>
	  </td>
  </tr>
</cfif>
</cfoutput>

Open in new window



ad
0
 

Author Comment

by:lulu50
ID: 39953889
Could not have done it without you!!!!!!!!!!!!!!!!!!!

Thank you lol
0
 

Author Closing Comment

by:lulu50
ID: 39953891
Excellent+++++
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 39953959
Super, glad it worked!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

821 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