The field has the correct number of days from or past the expiration date. The report shows the days properly. I am using the script below to change the color based on the number of days before and after the expiration date. Everything works EXCEPT the calculated field with days -1000 or more (-1200, -1673, etc) will always turn RED. Even though that indicates the date is not for a few years away. the magic number is -999 for it to work and when the date is farther out it always turns RED.
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.
Question
techguy
hello,
I have a calc field in a tab report and I am colorizing the expiration date based on a formula. The formula I use is:
Datediff(day,[@field:ExpireDate],Dateadd(hour,-8,GetUTCDate()))
The field has the correct number of days from or past the expiration date. The report shows the days properly. I am using the script below to change the color based on the number of days before and after the expiration date. Everything works EXCEPT the calculated field with days -1000 or more (-1200, -1673, etc) will always turn RED. Even though that indicates the date is not for a few years away. the magic number is -999 for it to work and when the date is farther out it always turns RED.
Any suggestions???
</div>
<script>
var isi = document.getElementById('visi[@field:TrainingID]').parentNode.parentNode;
if([@calcfield:1#] < -59){
isi.querySelector('td:nth-child(8)').style.backgroundColor = 'green';
isi.querySelector('td:nth-child(8)').style.color = 'white';
}
else if([@calcfield:1#] > -60 && [@calcfield:1#] < -1){
isi.querySelector('td:nth-child(8)').style.backgroundColor = 'yellow';
isi.querySelector('td:nth-child(8)').style.color = 'black';
}
else{
isi.querySelector('td:nth-child(8)').style.backgroundColor = 'red';
isi.querySelector('td:nth-child(8)').style.color = 'white';
}
</script>
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
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.