import("Sql_lib"); import("system.neon"); import("system.vars"); import("system.result"); var count = new SqlBuilder().selectCount() .from("ADVERTISING") .where("ADVERTISING.OBJECT_ROWID", vars.get("$field.ACTIVITYID")) .cell(); var state = neon.COMPONENTSTATE_INVISIBLE; if(count == 1) { state = neon.COMPONENTSTATE_EDITABLE; } result.string(state);