如何在Openbravo的“定义的选择器”中添加唯一性以过滤表达式?

时间:2018-07-17 10:47:17

标签: hql openbravo

我现在使用的过滤器表达式是

#!/bin/bash

TOMCAT_HOME=/opt/tomcat
PUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo`
EMAIL_BODY="Hi Admin,\n\n$PUBLIC_IP Tomcat is down at $(date -d "+330 minutes" +"%Y-%m-%d %T") IST, Please take necessary action.\n\n\nDo not reply to this email as it is auto generated by Ubuntu system\n"

tomcat_pid() {
  echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`
}

start() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ] 
  then
    echo "Tomcat is already running (pid: $pid)"
  else
    # Start tomcat
    echo "Starting tomcat"
    /bin/sh $TOMCAT_HOME/bin/startup.sh
  fi


  return 0
}

pid=$(tomcat_pid)

 if [ -n "$pid" ]
  then
    echo "Tomcat is running with pid: $pid"
    #stop
  else
    echo "Tomcat is not running"
    # send an email alert then start
    echo -e $EMAIL_BODY | mail -s "$PUBLIC_IP Tomcat is down" user@email.com
    echo "Mail sent"
    #remove cache and release memory occupied by heavy processes
    start
  fi
exit 0

在这里,e是填充在'Table'中的当前表,而contract是其中的列(在POJO类中),用于存储subscriptionId的值。

问题是下一层“定义的选择器字段”中的属性,我在其中显示了某个列exColumn具有[从上述表达式中选择的]许多行,并且具有相同的值。

在这里,我打算在过滤器表达式或HQL中(在运行时似乎没有进行过滤)或“定义的选择器”字段中添加一个唯一性,以便我们不显示重复的值。 / p>

1 个答案:

答案 0 :(得分:2)

您不能在用于限制数据源结果的过滤器表达式中添加distinct

您有2种不同的选择:

  1. 根据自定义查询定义选择器,并在其中写入HQL以检索值。在此查询中,您可以拥有distinct。例如,您可以检查以这种方式实现的未默认由客户/供应商选择的业务伙伴选择器。
  2. 从视图中将选择器基于表:
    • 使用您需要的基本SQL查询(包括distinct)创建数据库视图。
    • 将其注册为应用程序字典 Table
    • 基于选择器
相关问题