'Constructor
@param resource: the resource
@param selector: the field selector (string)'

def __init__(self, resource, selector, label=None):

    self.resource = resource
    self.selector = selector
    lf = S3FieldPath.resolve(resource, selector)
    self.tname = lf.tname
    self.fname = lf.fname
    self.colname = lf.colname
    self._joins = lf.joins
    self.distinct = lf.distinct
    self.multiple = lf.multiple
    self._join = None
    self.field = lf.field
    self.virtual = False
    self.represent = s3_unicode
    self.requires = None
    if (self.field is not None):
        field = self.field
        self.ftype = str(field.type)
        if ((resource.linked is not None) and (self.ftype == 'id')):
            self.represent = (lambda i, resource=resource: resource.component_id(None, i))
        else:
            self.represent = field.represent
        self.requires = field.requires
    elif self.colname:
        self.virtual = True
        self.ftype = 'virtual'
        method = lf.method
        if hasattr(method, 'handler'):
            handler = method.handler
            if hasattr(handler, 'represent'):
                self.represent = handler.represent
            if hasattr(handler, 'search_field'):
                self.search_field = handler.search_field
    else:
        self.ftype = 'context'
    if (label is None):
        fname = self.fname
        if (fname in ['L1', 'L2', 'L3', 'L3', 'L4', 'L5']):
            try:
                label = current.gis.get_location_hierarchy(fname)
            except:
                label = None
        elif (fname == 'L0'):
            label = current.messages.COUNTRY
        if (label is None):
            f = self.field
            if f:
                label = f.label
            elif fname:
                label = '    '.join([s.strip().capitalize() for s in fname.split('_') if s])
            else:
                label = None
    self.label = label
    self.show = True
    self._is_numeric = None
    self._is_lookup = None
    self._is_string = None
    self._is_datetime = None
    self._is_reference = None
    self._is_list = None
