Edit Fork Copy int getParentId(int id) { record = db.getItem(id); if (record.id_cha == 0) return id; return getParentId(record.id_cha); }