'Represent a single Row
@param row: the supply_item_category Row'

def represent_row(self, row):

    use_code = self.use_code
    name = row['supply_item_category.name']
    code = row['supply_item_category.code']
    catalog = row['supply_catalog.name']
    parent = row['supply_parent_item_category.name']
    if use_code:
        name = code
    elif (not name):
        name = code
    if parent:
        if use_code:
            sep = '-'
        else:
            sep = '    -    '
        name = ('%s%s%s' % (name, sep, parent))
        grandparent = row['supply_grandparent_item_category.name']
        if grandparent:
            name = ('%s%s%s' % (name, sep, grandparent))
            greatgrandparent = row['supply_grandparent_item_category.parent_item_category_id']
            if greatgrandparent:
                db = current.db
                table = current.s3db.supply_item_category
                ptable = db.supply_item_category.with_alias('supply_parent_item_category')
                gtable = db.supply_item_category.with_alias('supply_grandparent_item_category')
                left = [ptable.on((ptable.id == table.parent_item_category_id)), gtable.on((gtable.id == ptable.parent_item_category_id))]
                query = (table.id == greatgrandparent)
                fields = [table.name, table.code, ptable.name, ptable.code, gtable.name, gtable.code]
                row = db(query).select(left=left, limitby=(0, 1), *fields).first()
                if row:
                    if use_code:
                        greatgrandparent = row['supply_item_category.code']
                        greatgreatgrandparent = row['supply_parent_item_category.code']
                    else:
                        greatgrandparent = (row['supply_item_category.name'] or row['supply_item_category.code'])
                        greatgreatgrandparent = (row['supply_parent_item_category.name'] or row['supply_parent_item_category.code'])
                    name = ('%s%s%s' % (name, sep, greatgrandparent))
                    if greatgreatgrandparent:
                        name = ('%s%s%s' % (name, sep, greatgreatgrandparent))
                        if use_code:
                            greatgreatgreatgrandparent = row['supply_grandparent_item_category.code']
                        else:
                            greatgreatgreatgrandparent = (row['supply_grandparent_item_category.name'] or row['supply_grandparent_item_category.code'])
                        if greatgreatgreatgrandparent:
                            name = ('%s%s%s' % (name, sep, greatgreatgreatgrandparent))
    if catalog:
        name = ('%s    >    %s' % (catalog, name))
    return s3_str(name)
