Solved

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

Posted on 2014-03-25
8
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
DevOps Toolchain Recommendations

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

 

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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

710 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