Jump to content

Recommended Posts

Hi,

I'm trying to hide two columns in a tabular report if one of the fields has null values or is empty.  I've tried the following Java Script several different ways, but can't seem to get it to work correctly.  A submission form feeds this tabular report, and if the user doesn't enter values in the 'Qty' field, it should be hidden on the tabular report.

<script>
var stl='none';  
var tbl = document.getElementsByTagName('table')[0];
var rows = tbl.getElementsByTagName('tr');
var EmpQty = ("[@field:Employee_Productivity_Qty]").length;

if (EmpQty<0) {

for (var row=1; row<rows.length;row++)
{
var cels = rows[row].getElementsByTagName('td');
cels[7].style.display=stl;
cels[8].style.display=stl;
}
var heads= tbl.getElementsByTagName('th');
heads[7].style.display=stl;
heads[8].style.display=stl;
}
</script>

Thank you!

 

 

Screen Shot of Tabular Report.JPG

Share this post


Link to post
Share on other sites

Hi @888Washington,

You can also just try to use this code instead:

<script type="text/javascript">

var elems = document.querySelector(".cbResultSetTable tbody").children;
console.log(elems);

for (let i = 0; i < elems .length; i++) {
elems[i].children[07].style.display = "none";
elems[i].children[08].style.display = "none";
}

</script>

Just change the child number in this line "elems.children[07].style.display = "none";", first column is "0" and so on. 

Note: Add this code inside your Footer, make sure that you unchecked the "enable HTML Editor" in the advance option.

I hope this helps :) 

~WatashiwaJin~

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...