Jump to content
  • 0

Conditional Formatting for Blank Cells


Libby

Question

Hello, I have reviewed this page below, but I'm not sure if this is the right solution for me.  I have a tabular report, and if there is a blank cell, I would like the background to highlight yellow.  What is the best way to do that?  See my screen shot below, where ideally, a header or footer code would make these fields jump out as bright yellow.

Thank you!

image.png.c9843258706a8c02dcda786d72fb62f7.png

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello @Libby,

We can achieve this using JavaScript custom coding.

You may need to put the fields between two HTML blocks. The first HTML Block should consist of this code:
-------
<div id="visi[@field:UniqueIDName]">
-------

For the second HTML Block please paste this code:
-------

</div>
<script>
var isi = document.getElementById('visi[@field:UniqueIDName]').parentNode.parentNode;
if('[@field:FieldName]' == " "){
isi.querySelector('td:nth-child(5)').style.backgroundColor = 'yellow';
}
else{
isi.querySelector('td:nth-child(5)').style.backgroundColor = 'red';
}
</script>

You need to change the nth child based on the position of your field. 

I hope this works.

- Barbie

Link to comment
Share on other sites

  • 0

Hi @Batchini, Yes you need to use a different code because Tabular Report and Gallery report has different structures,

You can use this codes below. Put the fields between two HTML blocks. The first HTML Block should consist of this code:
 

<div id="visi[@field:UniqueIDName]">


For the second HTML Block please paste this code:

</div>
<script>
if('[@field:FieldName]' == '')
{
var isi = document.querySelector("#visi[@field:UniqueIDName] > span:nth-child(5)")
isi.style.color='put your preferred color here';
}
</script>

-------

As I mentioned above, you need to change the nth child based on the position of your field. 

I hope this works. 

Barbie

Link to comment
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
Answer this question...

×   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...