0
votes

I have a datawindow with 3 columns. I want to somehow inform the user that the value of a column is available 5 days from today. Like a countdown. After those 5 days the column takes the default value. Is that possible?

1
It is not clear what you are trying to achieve. The value of "today" never changes, so the comment about "after those 5 days" is not clear. But it seems that you need to write some code to do "something" after you populate your datawindow. How you do that and what you do depends on your code. It may be that you need to add a column to your table to mark the date that starts this countdown period.SMor

1 Answers

0
votes

Use data window expressions!

They can be used via the datawindow painter and allow very fine control on the display without the burden of programming. More specifically, in this case, I suppose you have a column 'expiry' to specify the maximum period of availability. In the datawindow painter, click on the column for which you want something to happen. In the 'Background' tab, put

Gradient: horizontal 
Color: Red 
Spread: expression (see the little box on the right?)

'spread' can have a value from 0 to 100, so compute an expression to go from 0 to 100 depending on the number of remaining days:

100 -((5 - if(daysafter( expiry , today ) < 5, daysafter( expiry , today() ), 5 ))* 20)

With this, the 'red' background color will spread more or less depending on the number of days remaining.

Other possibility: use the 'Tooltip' tab, enable the tooltip (first field) and put as message: 'You have ' + string (daysafter(expiry, today()) + ' days left to modify this field'

This will show a message (variable with the line) everytime you pass with the mouse on the field.

Once you get the trick, you can play around and have your own ideas using these datawindow expressions.