判断表格某一列是否重复或空
2010-03-09 22:05
288 查看
/**
* 判断分录表中的某一列是否存在空值
* @param kdtEntry
* @param colName
* @throws BOSException
*/
public static void checkTableColumnEmpty(
com.kingdee.bos.ctrl.kdf.table.KDTable kdtEntry, String colName)
throws BOSException {
for (int i = 0, n = kdtEntry.getRowCount(); i < n; i++) {
Object temp = kdtEntry.getRow(i).getCell(colName).getValue();
if (temp == null || temp.toString().equals("")) {
throw new BOSException("第" + (i + 1) + "行的"
+ kdtEntry.getHeadRow(0).getCell(colName).getValue()
+ "不能为空");
}
}
}
/**
* 检查表格某n列是否为空
* @param kdtEntry:表格
* @param colNames:列名数组
* @throws BOSException
*/
public static void checkTableColumnsEmpty(com.kingdee.bos.ctrl.kdf.table.KDTable kdtEntry,
String colNames[]) throws BOSException {
int i = 0;
for (int n = colNames.length; i < n; i++)
checkTableColumnEmpty(kdtEntry, colNames[i]);
}
/**
* 检查某一列是否重复
* @param kdtEntry
* @param colName
* @throws BOSException
*/
public static void checkTableColumnRepeat(com.kingdee.bos.ctrl.kdf.table.KDTable kdtEntry, String colName)
throws BOSException {
int i = 0;
for (int n = kdtEntry.getRowCount(); i < n; i++) {
Object temp = kdtEntry.getRow(i).getCell(colName).getValue();
for (int j = i + 1; j < n; j++)
if (temp.equals(kdtEntry.getRow(j).getCell(colName).getValue()))
throw new BOSException("第" + (i + 1)+ "行和第"+ (j + 1)+
"行的"+ kdtEntry.getHeadRow(0).getCell(colName).getValue() + "重复");
}
}
public static void checkTableColumnsRepeat(com.kingdee.bos.ctrl.kdf.table.KDTable kdtEntry, String colNames[])
throws BOSException {
int i = 0;
for (int n = colNames.length; i < n; i++)
checkTableColumnRepeat(kdtEntry, colNames[i]);
}
* 判断分录表中的某一列是否存在空值
* @param kdtEntry
* @param colName
* @throws BOSException
*/
public static void checkTableColumnEmpty(
com.kingdee.bos.ctrl.kdf.table.KDTable kdtEntry, String colName)
throws BOSException {
for (int i = 0, n = kdtEntry.getRowCount(); i < n; i++) {
Object temp = kdtEntry.getRow(i).getCell(colName).getValue();
if (temp == null || temp.toString().equals("")) {
throw new BOSException("第" + (i + 1) + "行的"
+ kdtEntry.getHeadRow(0).getCell(colName).getValue()
+ "不能为空");
}
}
}
/**
* 检查表格某n列是否为空
* @param kdtEntry:表格
* @param colNames:列名数组
* @throws BOSException
*/
public static void checkTableColumnsEmpty(com.kingdee.bos.ctrl.kdf.table.KDTable kdtEntry,
String colNames[]) throws BOSException {
int i = 0;
for (int n = colNames.length; i < n; i++)
checkTableColumnEmpty(kdtEntry, colNames[i]);
}
/**
* 检查某一列是否重复
* @param kdtEntry
* @param colName
* @throws BOSException
*/
public static void checkTableColumnRepeat(com.kingdee.bos.ctrl.kdf.table.KDTable kdtEntry, String colName)
throws BOSException {
int i = 0;
for (int n = kdtEntry.getRowCount(); i < n; i++) {
Object temp = kdtEntry.getRow(i).getCell(colName).getValue();
for (int j = i + 1; j < n; j++)
if (temp.equals(kdtEntry.getRow(j).getCell(colName).getValue()))
throw new BOSException("第" + (i + 1)+ "行和第"+ (j + 1)+
"行的"+ kdtEntry.getHeadRow(0).getCell(colName).getValue() + "重复");
}
}
public static void checkTableColumnsRepeat(com.kingdee.bos.ctrl.kdf.table.KDTable kdtEntry, String colNames[])
throws BOSException {
int i = 0;
for (int n = colNames.length; i < n; i++)
checkTableColumnRepeat(kdtEntry, colNames[i]);
}
相关文章推荐
- jquery 判断表格同一列不同行<input >数据是否重复
- Java 如何判断导入表格某列是否有重复数据
- 判断表格中同一属性多个输入框内容是否重复
- jquery如何判断表格同一列不同行input数据是否重复
- java 如何判断导入表格某列是否有重复数据
- jquery如何判断表格同一列不同行input数据是否重复
- jquery如何判断表格同一列不同行input数据是否重复
- 判断字符串是否没有重复字符
- 判断Table表中是否含有某一列
- JavaScript 判断两个数组是否相等 或者 判断一个数组中是否有重复的元素
- 判断参数和数据库数据是否重复最简单的方法
- 用Set判断List是否有重复值
- 哈希变形—位图(给定40亿个不重复的无符号数整数,没排过序,给一个无符号整数,如何快速判断一个数是否在这40亿个数中)
- 怎样判断set集合元素是否可以重复存取
- 判断数组是否有重复项
- 在表格中判断当前日期是否快到期
- 打开对话框,选择文本,判断是否有重复的
- 判断数组元素是否重复
- 判断用户输入的数字是否有重复(Duplicate Elimination)
- 可判断datatable的列是否有重复