Jump to content

Highlight Date In Tabular Report - Not Entire Row


Recommended Posts

  • 3 weeks later...

Hi @kpcollier

 

Try this solution: 

 

1. Add a Calculated Field with a syntax similar to this one.

CASE 

WHEN DATEDIFF(day, [@field:date], '[@cbTimestamp]') >= 21
THEN 'Expired'

END

 

2. Add an HTML Block with this Syntax

<span custom-data="[@calcfield:1]">[@field:date*]</span>

 

3.) Easily style this HTML Markup in your Styles (CSS Rules). I'd suggest, in the header:

You can post this everywhere you want:

<style>

[custom-data="Expired"] {
background-color: red;
}

</style>

 

Hope this helps.

`DN31337!

Link to comment
Share on other sites

  • 1 month later...

Hey @DefinitelyNot31337, just coming back to this. 

I've got the calc field going. I am however having trouble with the HTML block and the CSS Rule:

Is the [@field:date*] in the html block suppose to be the same as the [@field:date] in the calculate field? Also, if so, are you hiding the calculated field, or is the HTML block and the Calc Field suppose to show up, both saying expired?

Link to comment
Share on other sites

Hi @kpcollier,

 

To answer your questions,

1.) It is NOT necessary for the [@field:date*] in the HTML Block, and [@field:date] in the Calculated Field to be the same

2.) In my post, I am NOT yet hiding the Calculated Field, but we can easily do so by sandwiching the Calculated Field in <table style="display: none;"> tag

 

Our main objective is for our HTML Block to produce this markup:

<span custom-data="Expired">I can be anything!</span>

 

Once we achieve this, we can style the <span> tags with the attribute custom-data="Expired" via CSS

<style>
  
[custom-data="Expired"] {
  background-color: red;
  color: orange;
  padding: 4px;
}
  
</style>

 

See this codepen sample, we're just simulating this in Caspio:

https://codepen.io/anon/pen/NZzBwj

 

Hope this makes sense.

 

Regards,

DN31337!

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