Using Perl script to identify and highlight rows based on specific cell values

I am struggling with how to highlight a row when Column F displays a value of F. I understand that I can achieve this using CSS/JS, but I keep hitting a roadblock. Coding is new to me, so I would greatly appreciate some assistance if possible.

Objective: I need the entire row to be highlighted in yellow when Column F shows a value of F.

Thank you for your help in advance!!!

    <div class='row'>
                <div class='col-lg-12 col-sm-12'>
                    <div class='panel panel-primary'>
                        <div class='panel-heading'>
                            <h3 class='panel-title'><i class='fa fa-bar-chart-o'></i>Priority Lots</h3>
                        </div>
                        
                        <table class='table'>
                            <thead>

                            <tr>
                                    <th>LOT</th>
                                    <th>LPT</th>
                                    
                                    <th>OPN</th>
                                    <th>DEVICE</th>
                                    <th>QTY</th>
                                    <th>DTTM</th>

                                    <th>I</th>
                                    <th>H</th>
                                    <th>F</th>
                                    <th>P</th>

                                    <th>S</th>
                                    <th>LOCATION</th>
                                    <th>STATUS</th>
                                    <th>EQUIP</th>
                                </tr>
                            </thead>
                            
                    </div>
                    
                    
$sqlstr="select l.lot, l.lpt, lc.opn, ls.device, l.cur_qty as qty, 
round((sysdate - l.last_act_dttm)*24,1) as dttm, 
l.isc as i, l.hold as h, l.ftr_hold as f, ls.priority as p, 
ls.swr as s, ls.lot_code3 as location, 
decode (lc.lot_status,'P',' Processing ') as status, lc.equip
from lot l, lot_str ls, lot_cur_opn lc, lpt_grp_lpt_lst lg  
where l.facility = 'DP1DM5' and lc.facility = l.facility 
and ls.facility = l.facility and lg.lpt_grp_facility = 'DP1DM5'
and l.lot = ls.lot and l.lot = lc.lot 
and ls.latest = 'Y' and ls.priority != 'N' 
and ls.priority IN ('0','1','2','3')
and l.lpt < 'TRM' and ls.latest = 'Y' and l.lpt = lg.lpt
and lg.lpt_grp_type = 'G' and lg.lpt_grp = '3005'
order by p, lpt

";
$sth = $dbh->prepare($sqlstr);
$sth->execute();
$sth->bind_columns(undef, \$LOT, \$LPT, \$OPN, \$DEVICE, \$QTY, \$DTTM, \$I, \$H, \$F, \$P, \$S, \$LOCATION, \$STATUS, \$EQUIP);

while($sth->fetch()) {
    

   print "
                    
        <tbody>
                            
        <tr class='row100 body'>
                                    <td class='cell100 column4'>$LOT</td>
                                    <td class='cell100 column4'>$LPT</td>
                                    <td class='cell100 column4'>$OPN</td>
                                    <td class='cell100 column4'>$DEVICE</td>
                                    <td class='cell100 column4'>$QTY</td>
                                    <td class='cell100 column4'>$DTTM</td>
                                    <td class='cell100 column4'>$I</td>
                                    <td class='cell100 column4'>$H</td>
                                    <td class='cell100 column4'>$F</td>
                                    <td class='cell100 column4'>$P</td>
                                    <td class='cell100 column4'>$S</td>
                                    <td class='cell100 column4'>$LOCATION</td>
                                    <td class='cell100 column4'>$STATUS</td>
                                    <td class='cell100 column4'>$EQUIP</td>
                                    
                                  
                                    

      


   </tr>";

   
}

                  

                    print "</tbody>
                        </table>
                        
                    </div>
                    <BR>
                    <BR>
                    </div>

Check out this screenshot of column F:

https://i.stack.imgur.com/8SG8U.png

Answer №1

When I created a basic stub HTML page, I successfully used this code to either highlight the row in yellow or leave it as is.

  my ($LOT, $LPT, $OPN, $DEVICE, $QTY, $DTTM, $I, $H, $F, $P, $S, $LOCATION, $STATUS, $EQUIP) = ('LOT', 'LPT', 'OPN', 'DEVICE', 'QTY', 'DTTM', 'I', 'H', 'F', 'P', 'S', 'LOCATION', 'STATUS', 'EQUIP');
  print "<html><body><table>\n";

# while($sth->fetch()) {
my $highlight = $F eq 'F' ? ' BGCOLOR="#FFFF00"' : '';
print "
        <tbody>
        <tr$highlight class='row100 body'>
                                    <td class='cell100 column4'>$LOT</td>
                                    <td class='cell100 column4'>$LPT</td>
                                    <td class='cell100 column4'>$OPN</td>
                                    <td class='cell100 column4'>$DEVICE</td>
                                    <td class='cell100 column4'>$QTY</td>
                                    <td class='cell100 column4'>$DTTM</td>
                                    <td class='cell100 column4'>$I</td>
                                    <td class='cell100 column4'>$H</td>
                                    <td class='cell100 column4'>$F</td>
                                    <td class='cell100 column4'>$P</td>
                                    <td class='cell100 column4'>$S</td>
                                    <td class='cell100 column4'>$LOCATION</td>
                                    <td class='cell100 column4'>$STATUS</td>
                                    <td class='cell100 column4'>$EQUIP</td>
   </tr>";
}
print "</tbody></table>\n";
#
  print "</body></html>\n";

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Background image not visible on Firefox and Chrome when using a DIV element

I'm encountering an odd issue where my DIV background isn't showing up in Firefox and Chrome, but it looks fine in IE. I've searched on several places like Stackoverflow for solutions to this problem, but none of them have worked for me so f ...

What is the best way to arrange these containers in a horizontal stack?

Check out the code snippet at: https://codepen.io/shayaansiddiqui/pen/YzGzeOj I'm looking to align these boxes horizontally, how can I achieve that? <div> <div class="container"> <img src="#" ...

Bootstrap Tags Input - the tagsinput does not clear values when removed

I am attempting to manually remove the input value from bootstrap-tags-input when the x button is clicked, but the values are not changing in either the array or the inputs. This is the code I have tried: $('input').tagsinput({ allowDuplica ...

Set tab navigation widget with a fixed height

I am struggling with setting a fixed height for my tabs widget so that when I add more content, it will display a scrollbar instead of expanding endlessly. I have checked the CSS and JS files but cannot figure it out. It is important for me to contain this ...

Tips on implementing a circular progress bar with locomotive scroll functionality

Can anyone help me integrate progress functionality with Locomotive Scroll using JavaScript? Link to CodePen for reference Check out this code snippet from Locomotive Scroll that calculates the percentage of pages scrolled: const scroller = new Locomotiv ...

Navigate directly to a specific section on a webpage

Check out these different links: <a class="faq_text_header_jump" href="#general_questions">Questions About General Topics</a><br> <a class="faq_text_header_jump" href="how_to_use_platform">How to Use the Platform</a><br ...

Creating a New Section in your HTML Table

Can a page break be implemented in an HTML table? I've attempted to add page breaks to the following HTML: <html> <title>testfile</title> <meta http-equiv="expires" content="0" /> <meta http-equiv="cache-contr ...

Troubleshooting Problem with Accordion Size in CSS

I am facing an issue with a dropdown menu that I have created. The dropdown has parent and child rows to display controls, but the width of the Accordion is not stretching as expected despite being set to 100%. Using Chrome and Edge developer tools, I insp ...

Move your cursor over the top and bottom of the image to experience distinct effects

Trying to create an effect where the top 50% of an image shows a different color and text when hovered over, and same for the bottom 50%. Currently, only able to achieve this effect for the lower half of the image. Is there a way to make it work for both h ...

Arrangement of asymmetrical interactive forms

I am in need of creating a design featuring numerous non-rectangular shapes that are interactive and reveal an image when clicked. The concept is to transform an image of stained glass into a webpage where each pane can be clicked to unveil its colorful ve ...

Maintain the aspect ratio of an image within a flex container when the height is adjusted

I'm currently facing an issue with an image in a flex container. My goal is to maintain the image's ratio when the height of the container or window is decreased or resized. Check out this sample fiddle html, body { height: 100%; } .wrappe ...

Ensure that the div element spans the entire width of the screen

Having issues working with the div tag and encountering this problem: The left side doesn't extend as far as the right side, despite testing in multiple browsers. Here is the HTML code being used: <!DOCTYPE html> <html lang="en"> <h ...

"X-Requested-With" header not being included in XMLHttpRequest request

After successfully using jQuery.ajax() to make an ajax call to an MVC action, I decided to switch to using the XMLHttpRequest along with the HTML5 File API due to some forms containing file controls. However, since making this change, the MVC action no lon ...

Creating column gaps that remain consistent when resizing a webpage is essential for maintaining a clean and organized layout

Visit my current site [This is the HTML code for my website:][2] <div class="column-box" style="width: 100%"></div> <div id="column1" style="float:left; margin:15; width:33%;"> <p>Sara Adams<br> I am a Web Developer and C ...

htmlEnhance your webpage with a native-like combobox

<!DOCTYPE html> <html> <body> <form action="demo_form.asp" method="get"> <input list="browsers" name="browser" placeholder="choose browser"> <datalist id="browsers"> <option value="Internet Explorer"> ...

Printing Multiple Pages Using JavaScript and Cascading Style Sheets

Encountering difficulties displaying page numbers when printing multiple multipage reports Here is the provided HTML Format : <style type="text/css> body { counter-reset: report 1 page 0; } td.footer:after { counter-increment: page; content ...

Align dropdown navigation menu/sorting dropdown in the same position as the button

Exploring the world of dropdown menus in CSS has led me to encounter some challenges. I am striving to ensure that the dropdown boxes appear on the same line as the button that triggers them. Below is the CSS code I have been working with: /* global style ...

Steps to customize a CSS file within node_modules

Is there a way to make changes to a CSS file in the "node_modules" dependency without them being overwritten when I run npm install? I want to keep the modifications I've made to the node module files. ...

I'm having trouble setting the margin to 0 in Bootstrap 4. I'm only using CSS for styling and JavaScript for

Currently in the process of setting up a grid layout for a webpage under development. Encountering an issue with the .container class, that is supposed to contain all my div elements, not having any margin. Managed to remove the margin on the left side usi ...

Unexpected issue on AngularJS application

Encountering issues with incorporating a controller into my page - each time I add it to a DOM element, an error is thrown. Here's the structure of my HTML page: <html data-ng-app="sportsStore"> <head> <title>Sports Sto ...