Oracle APEX - 根据包含的值有条件地更改交互式报表上单元格中的文本颜色?
好吧...那么。我在 APEX 中有一个交互式报告,显示有关我们系统中文档的数据。我们的文件应该每两年审查一次,表中有一列包含文件下次审查的日期。我们希望在包含日期的单元格或行中的另一个单元格中直观地指示日期何时达到特定基准(即,当日期在当前日期的 6 个月内、3 个月、2 个月、1 个月等)
我需要做的是根据特定单元格的值或同一行中另一个单元格的值更改该单元格的文本(或背景)的颜色。需要有一个进程或某些函数进行一些计算,以确定 sysdate 和单元格中包含的日期之间的跨度...它不一定需要计算页面加载的时间,而是每天或每周的进程或某件事会很好。
是否可以设置每天执行而无需人工交互的流程或触发器?我还需要使用相同的功能来发送有关即将到来的截止日期的提醒电子邮件。 (即,当文件距离需要审查还有 6 个月时,我们会在 3 个月、2 个月、1 个月等时发出电子邮件)
Ok... So. I have an interactive report in APEX that displays data about documents in our system. Our documents are supposed to be reviewed every two years and there is a column in the table that contains the date that the document should be next reviewed by. We want to visually indicate either in the cell that contains the date, or another cell in the row, when the date reaches certain benchmarks (i.e. When the date is within 6 months of the current date, 3 months, 2, 1 etc.)
What I need to hopefully do is to change the color of the text (or background) of a specific cell based on either the value of that cell or the value of another cell in the same row. There would need to be a process or some function that does some computation to determine the span between the sysdate and the date contained in the cell... It does not necessarily need to calculate when the page is loaded but a daily or weekly process or something would be good.
Is it possible to set up processes or triggers that execute daily without human interaction? I also have a need to use the same functionality for sending reminder emails about these upcoming deadlines. (i.e. when a document is 6 months out from needing to be reviewed an email would be sent out, at 3 months, 2, 1 etc.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
emp 上的hiredate 示例:我即将为> 的单元格着色。 11000。(sysdate-hiredate 范围从大约 10k 到 12k)。您可以使用在查询中计算的字段,或者通过某个过程填写的字段,这并不重要:)
您将需要 2 个动态操作来为报告中的行着色:一个加载操作和一个刷新后操作。如果您跳过刷新后,由于部分页面刷新,例如分页后,行将不会着色。
动态操作一:区域刷新后:
真实操作:
使用一列作为条件为另一列着色的示例。始终要小心您测试的内容以及测试的目的!例如,hiredate 列是一个日期,如有必要,请务必将其视为日期!还要进一步注意:如果您的日期格式设置为 DD-MON-YYYY,那么您必须将月份映射到数字(JAN = 1,DEC = 12)!也许可以选择更改此列的日期格式,甚至...
第二个动态操作:加载
作为真实操作,使用与刷新真实操作相同的代码。
使用 JS,你可以做任何你想做的事情:你只需要知道你想要绘制哪些单元格。使用
[headers='']
定位您想要的单元格 (jquery 选择器)。例如,您可以使用 addClass 来代替 css(),如果您更喜欢的话。
请注意:IR 带有内置的鼠标悬停操作。这会导致您绘制的单元格在鼠标悬停操作时不显示其颜色。如果您不希望这样做,则需要对 mouseover/mouseleave 事件执行另一个动态操作,并定位那些必要的单元格。
至于计划作业:查看DBMS_JOBS。
Example with hiredate on emp: i'm about to colour the cells that are > 11000. (sysdate-hiredate ranges from about 10k to 12k). You could use a field you calculate in the query, or one you filled in through some procedure, doesn't matter :)
You will need 2 dynamic actions to colour rows in reports: an onload action, and an after refresh. If you skip the after refresh, rows won't be coloured after for example pagination, due to partial page refreshing.
Dynamic action one: After refresh on the region:
True action:
Example of using one column as a condition to colour another column. Always be carefull with what you test and what you test it for! For example, the hiredate column is a date, be sure to treat it as such if necessary! Further caution too: if your date format is set as DD-MON-YYYY, then you'd have to do the mapping for month to number (JAN = 1, DEC = 12)! Maybe it is an option to change the date format for this column even...
The second dynamic action: on load
As true action, use the same code as the true action for the refresh.
With the JS you can do whatever you want: you just need to know which cells you wish to paint. Use the
[headers='']
to target the cells you'd like (jquery selectors).Instead of the css(), you can use addClass for example, if that is more what you'd like.
Do mind: IRs come with built-in mouseover actions. This causes your painted cells not to show in their colour when there is a mouseover action. If you don't want this, you'd need another dynamic action for the mouseover/mouseleave events, and target those cells necessary.
As for scheduled jobs: check out DBMS_JOBS.
在交互式报告中,您还可以定义报告(带有突出显示),这将为您解决问题。
选择“操作”按钮,然后选择“格式”(在弹出窗口中)和“
突出显示”。在突出显示中,您可以指定名称、类型(行或单元格)、背景和文本颜色,以及您想要在其上添加操作符和表达式的列。
您应用高光(当您需要多种颜色高光时,根据您的表达方式,制作多个高光/其他名称)。
与最重要的过滤器一起保存为报告(第一个主要过滤器)。
定义主要报告后,您可以将其作为基础报告。使用其他过滤器制作一些其他报告(并保存它们),但具有与主要报告相同的突出显示)。
玩得开心。
In an Interactive Report, you also can define REPORTS ( with HIGHLIGHTS), which will do the trick for you.
Choose button ACTIONS, Then FORMAT (on Pop-up) and the HIGHLIGHT
In HighLight you can give a Name, Type (Row or Cell), Background and Text Colour, and the COLUMN on which you want an OPERATOR and an EXPRESSION.
You Apply the Highlight (Make Several Highlights /other-name when you need more than one colour-highlight depending on your EXPRESSION-s).
Together with the most important Filters then SAVE it as a Report (First Primary).
After having defined the Primary Report you can take this as the basis-report. Make some other Reports (and save them) with other filters, but with the same Highlights as the Primary Report).
Have FUN with it.