domino如何定时自动修改视图筛选公式

新增java代理-定时执行

原理:使用视图SelectionFormula属性修改视图筛选条件。已达到动态修改视图筛选条件的问题。

运用场景:比如公告模块的过滤过期的公告,可以使用这个属性每天修改视图条件,避免视图中直接出现动态的时间进行筛选。

主要视图如果出现动态的时间筛选 对性能影响较大,应该避免。

SELECT form = "bulletin" & eday>=@Today    高耗能,动态时间,每次执行都会更新索引,执行会很慢

SELECT form = "bulletin" & eday>= [2019-07-08]   低耗能。每天定时代理修改视图条件为静态的时间,

代码范例如下:

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      info("toUpViewFormula---beg");
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      View view = null;
      view = db.getView("(byNumtz)");
      view.setSelectionFormula(
        "@Now < @Adjust(@modified; 0; 0; 6; 0; 0; 0)");
      info("toUpViewFormula---end");
    } catch(Exception e) {
    	info("toUpViewFormula---执行异常");
      e.printStackTrace();
    }
  }
  
  public void info(Object obj)
	{
		System.out.println(obj);
	}
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值