根据重复值执行方法操作

Perform method action based on duplicate values

我有一个 table,我正在其上创建一个方法,我希望 运行 根据来自 2 个字段的重复值进行操作。

例如:

我有 Table A 其中包含这些字段:

IncidentDescription
Identifier

现在我想运行方法中的某个动作基于以下标准:

如果 IncidentDescription 已存在于同一 table 的另一行中,但前提是 Identifier 不同。 (因此,如果只有 1 行带有 IncidentDescription 存在,它不会 运行 操作)

我该如何解决这个问题?是否可以在 if statement 中完成此操作? 或者是否有一个 possibility/is 比 运行 一个 "while select" 查询更好,并且(如果存在)运行 一个基于计数结果(>1)的计数方法。

编辑:

我正在尝试创建如下查询:

    select count (IncidentDescription) from TableA;
    {

// I am trying to convert the result, because it gives me the error: "Operand types are not compatible with the operator, i am not sure how to make this.
        serialCount = str2num(IncidentDescription);

    if (IncidentDescription > 1)
           //Action to go here;
    }

我稍后会在标识符中构建。

请参考以下代码,根据您的需求修改:

TableA  tableA;
TableA  tableAJoin;
;

select firstOnly tableA
    join tableAJoin
        where tableA.IncidentDescription == tableAJoin.IncidentDescription 
           && tableA.Identifier          != tableAJoin.Identifier;

if (tableA.RecId)
{
    info(strFmt("%1 - %2", tableA.Identifier, tableA.IncidentDescription));
    info(strFmt("%1 - %2", tableAJoin.Identifier, tableAJoin.IncidentDescription));
}

如果您需要在表单数据源(其中 tableA 是数据源名称)上检查 displayOption 方法,请按如下方式修改它

public void displayOption(Common _record, FormRowDisplayOption _options)
{
    TableA  tableACurrent;
    TableA  tableALocal;
    ;

    tableACurrent = _record;

    select firstOnly RecId from tableALocal
        where tableALocal.IncidentDescription == tableACurrent.IncidentDescription 
           && tableALocal.Identifier          != tableACurrent.Identifier;

    if (tableALocal.Identifier)
    {
        //record has dublicates
        ...
    }

    super(_record, _options);
}