天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 1697|回复: 0

[函数] 判断字段不能重复【函数-notRepeated (fieldName, tableName, description, andSQL)】

[复制链接]
purple 发表于 2011-11-29 10:51:32 | 显示全部楼层 |阅读模式
函数格式:
notRepeated (fieldName, tableName, description, andSQL)
函数说明:
fieldName: 字段名
tableName: 对比字段名
description: 描述
andSQL:添加额外条件(可不传)
示例:
实现notRepeated (fieldName, tableName, description, andSQL)函数的应用
function notRepeated(fieldName, tableName, description, andSQL) {
        var doc = $CURRDOC.getCurrDoc();
        var returnStr = "";
        var dql = "$formname='" + tableName + "' and " + fieldName + "='" + getItemValue(fieldName) + "'";
        if (andSQL) {
                dql += " and " + andSQL;
        }
        if (doc != null) {
                dql += " and $id<>'" + doc.getId() + "'";
        }
        var count = countByDQL(dql);
        if (count > 0) {
                returnStr = "'" + description + "' 不能重复!";
        }
        return returnStr;
}

调用
#include " validationlib";
notRepeated (" fieldName"," tableName"," description"," andSQL");

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-12 07:32

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表