Tuesday, 6 January 2015

To stop duplicate values to insert to same field in table : - With out setting index


 In Datasource level Validate method.  ( SMAObjectTable_AssetId.valueStr();- field in form , needed to declare auto declaration to true.
public boolean validate()
{
    boolean ret;

   SMAServiceObjectTable SMAServiceObjectTableloc;

    ret = super();

    select SMAServiceObjectTableloc where SMAServiceObjectTableloc.AssetId ==SMAObjectTable_AssetId.valueStr();
    if(SMAServiceObjectTableloc)
    {
        ret=  false;
        Box::warning("Asset Id is already assigned to some other Service object");
    }
    else
    {
        ret = true;
    }

    return ret;
}

No comments:

Post a Comment