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

My website is being cut off

After creating this website with a viewport setup, I noticed that it is not fully visible on certain screens. When viewed on a CRT monitor at 800x600 desktop resolution or lower than 1280x800, such as on mobile devices, the content gets clipped. Is there a ...

Using relative positioning in CSS causes the div to move to a new line

Feel free to check out this demo I've created for reference: http://jsfiddle.net/jcb9xm44/ In a nutshell, the scenario involves two inline-block divs nested within a parent div: <div class="outer"> <div class="inner1"> Y & ...

Tips for aligning an HTML button with a hyperlink

<form method="get" action=https://www.wwf.de/spenden-helfen/allgemeine-spende> <button type="submit">Donate Now</button> I am facing an issue where the button is appearing randomly on my website, but I need it to ...

Issues with scaling background videos in HTML5

I'm having trouble making a video scale properly with the browser window while still covering the entire area. Does anyone know why my current approach isn't working? HTML: <div class="bgVideoWrap"> <video id="bgVideo" loop="true" aut ...

Troubleshooting: Why isn't my jQuery Click Event functioning in Mozilla but working perfectly fine in

While I know this question has been asked before, I can't seem to locate the posts I remember reading about it. I apologize for any duplication, but I am trying to implement a "click anywhere BUT here to close element overlay" effect on my personal we ...

How to eliminate a hyperlink from an HTML element with the help of JQuery

Recently, I was assigned to revamp a website for the company I work for. However, upon closer inspection, I realized that the website is quite messy and relies heavily on templates, resulting in certain elements being auto-generated as active links. The i ...

Strikeout list on click of a mouse

Is there a way to apply strikethrough formatting to text with just a mouse click? The CSS for lists is beyond the form field margin. I've tried multiple methods without success. No matter how many times I change the code, I can't seem to get it r ...

Hiding a div becomes impossible once it has been set to display:block

When I click on an element, I want a box to open and then when I click on a "CLOSE" button, I want it to disappear. However, I am encountering an issue where the box appears using "display:block" but does not disappear with "display:none" as intended (see ...

Divider displayed between images in Internet Explorer 8

On my website, I have arranged four images in a square using the code below: <div id="tempo_main"> <div id="tempo_content"> <div style="text-align: center;z-index: 3;position: absolute;right:350px; left:350px; t ...

Formatting tabular rows to appear as headers

I am currently developing a mobile website that is specifically designed for older phones with minimal CSS and HTML support. Due to these limitations, I have decided to utilize tables in my design. My goal on a certain page is to create a table row with a ...

What causes an asynchronous function to exhibit different behavior when utilized in conjunction with addEventListener versus when manually invoked?

I was delving into the concepts of async and await keywords and decided to create a basic demonstration using an HTML file and a corresponding JS file. In my example, I defined two promises - promise1 and promise2. The handlePromises function uses async/ ...

Is there a way to remove <font> tags using Javascript designMode?

Currently, I am in the process of developing a WYSIWYG editor as a hobby project. My approach involves utilizing an iframe with design mode enabled and leveraging the execcommand feature in JavaScript to implement the editor functionalities. For instance, ...

I am currently facing an issue with retrieving the class value that is being generated by PHP code

I am currently facing an issue with jQuery and PHP. Whenever I attempt to target the click event on the class ".id_annonce" in the dynamically generated PHP code, it doesn't retrieve the exact value of what I clicked. Instead, it always gives me a fi ...

Styling applied exclusively to the field for mobile devices

As I work on creating a navigation bar using Bulma and Vue.js, I encounter an issue with the dropdown menu behavior. When the navbar collapses into the hamburger menu, the dropdown list remains in display: block; mode. To address this, I attempted a workar ...

Error: JSDOM - The document variable has not been declared

After creating a basic webpage that displays a single message, I decided to experiment with JSDOM and encountered an error. Despite researching online examples and Stack Overflow questions, I have struggled to resolve even the most straightforward scenario ...

Performing a search in Django using raw MySQL commands

I am currently in the process of developing a custom search engine that includes 4 search fields, aiming to search within a MySQL table. This snippet from my views.py covers the search functionality, pagination, and listing of the entire table data. def ...

Is there a way to assign innerHTML values to table cells using PHP?

I'm currently building a website that relies on a database to store information. I have created an array to hold the values retrieved from the database, and now I need to populate a table with these values. Each cell in the table has a numerical ID ra ...

Looking to add elements to a specific div dynamically using jQuery? Let's explore how to insert comments seamlessly

I would like to implement a comment system that adds entered comments to a specific div. Here's the code I have so far: <ul class="comments"> <li> <a class="commenter_name" href="/">Dushyanth Lion</a> ...

Tips for adjusting the font size within the MUI TextField Label

I'm looking to adjust the label fontSize in the material ui TextField component. I've discovered the InputLabelProps property which has been helpful, but as shown in the image below, the label appears too cramped when focused. Below is my implem ...

The navigation menu dissolves into hiding at the uppermost part of the page upon scrolling upwards on iOS devices

I am currently working on creating a navigation menu that will automatically hide when scrolling down and reappear when scrolling up. This functionality works perfectly fine on desktop and Android browsers, but I have encountered an issue specifically with ...