Given 2 fields, concat two years eg 2006 - 2008
In the config file use:
fieldName="func(CONCAT_DATE(StudyFrom,StudyTo))"
323580
private String concatDate(int rowIndex){

        if(params.length != 2){
            throw new IllegalArgumentException("Wrong number of Parameters for concat date expression");
        }

        final DateTimeFormat yearFormat = DateTimeFormat.getFormat(DataType.DATE_FORMAT_YEAR_ONLY);
        final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
        final String rawDateFrom = currentRecord.getValueByFieldName(params[0]);
        Date dateFrom = DataType.ParseUtil.tryParseDate(rawDateFrom, DataType.DEFAULT_DATE);
        final String rawDateTo = currentRecord.getValueByFieldName(params[1]);
        Date dateTo = DataType.ParseUtil.tryParseDate(rawDateTo, DataType.DEFAULT_DATE);


        String res;
        if(dateFrom.equals(dateTo)){
            res = yearFormat.format(dateFrom);
        }else{
            res = yearFormat.format(dateFrom) + " - " + yearFormat.format(dateTo);
        }
        return res;
    }
66484
def _from_to_as_term(self, frm, to):
        

        # The wackiness with the conversion to int and str, and adding ' ', is because there
        # can't be a space between the 'TO' and the brackets in the time range
        # when one end is open
        from_year = ''
        to_year = ''

        def year_or_empty(prefix, year, suffix):
            try:
                return prefix + str(int(year)) + suffix
            except (ValueError, TypeError):
                return ''

        if frm:
            from_year = year_or_empty('', frm, ' ')

        if to:
            to_year = year_or_empty(' ', to, '')

        if bool(from_year) or bool(to_year):
            return '[{}TO{}]'.format(from_year, to_year)
        else:
            return None
1113481
def concat(self, *args, **kwargs):
        
        for arg in args:
            assert self.formatted_text._is_compatible(arg), "Cannot concat text with different modes"
            self.format_args.append(arg.text)
        for kwarg in kwargs:
            value = kwargs[kwarg]
            assert self.formatted_text._is_compatible(value), "Cannot concat text with different modes"
            self.format_kwargs[kwarg] = value.text
        return self
1130774
def concatenate_fields(fields, dim):
    ''
    if len(fields) == 0:
        raise ValueError('fields cannot be an empty list')
    
    if len(set((f.name, f.shape, f.dtype) for f in fields)) != 1:
        raise ValueError('fields should have homogeneous name, shape and dtype')
    tpl = fields[0]
    attr = InstanceAttribute(tpl.name, shape=tpl.shape, dtype=tpl.dtype, 
                             dim=dim, alias=None)
    
    attr.value = np.array([f.value for f in fields], dtype=tpl.dtype)
    return attr
1066258
def _merge_fields(a, b):
    

    a_names = set(x[0] for x in a)
    b_names = set(x[0] for x in b)
    a_keep = a_names - b_names

    fields = []

    for name, field in a:
        if name in a_keep:
            fields.append((name, field))

    fields.extend(b)

    return fields
1163901
function year(options) {
    var content = ''
      , y = this.year;

    while(++y < this.max_year) {
      content += options.fn({
        year: y,
        selected: +this.expiration_year === y ? ' selected' : '',
      });
    }

    return content;
  }
321103
def concatenate(self, catalogue):
        

        atts = getattr(self, 'data')
        attn = getattr(catalogue, 'data')
        data = _merge_data(atts, attn)

        if data is not None:
            setattr(self, 'data', data)
            for attrib in vars(self):
                atts = getattr(self, attrib)
                attn = getattr(catalogue, attrib)
                if attrib is 'end_year':
                    setattr(self, attrib, max(atts, attn))
                elif attrib is 'start_year':
                    setattr(self, attrib, min(atts, attn))
                elif attrib is 'data':
                    pass
                elif attrib is 'number_earthquakes':
                    setattr(self, attrib, atts + attn)
                elif attrib is 'processes':
                    if atts != attn:
                        raise ValueError('The catalogues cannot be merged' +
                                         ' since the they have' +
                                         ' a different processing history')
                else:
                    raise ValueError('unknown attribute: %s' % attrib)
        self.sort_catalogue_chronologically()
422864
def dateDict(date, prefix = ""):
    """"""
    res = {}

    res[prefix+"a"] = date.strftime("%a")
    res[prefix+"A"] = date.strftime("%A")
    res[prefix+"b"] = date.strftime("%b")
    res[prefix+"B"] = date.strftime("%B")
    res[prefix+"c"] = date.strftime("%c")
    res[prefix+"d"] = date.strftime("%d")
    res[prefix+"H"] = date.strftime("%H")
    res[prefix+"I"] = date.strftime("%I")
    res[prefix+"j"] = date.strftime("%j")
    res[prefix+"m"] = date.strftime("%m")
    res[prefix+"M"] = date.strftime("%M")
    res[prefix+"p"] = date.strftime("%p")
    res[prefix+"S"] = date.strftime("%S")
    res[prefix+"U"] = date.strftime("%U")
    res[prefix+"w"] = date.strftime("%w")
    res[prefix+"W"] = date.strftime("%W")
    res[prefix+"x"] = date.strftime("%x")
    res[prefix+"X"] = date.strftime("%X")
    res[prefix+"y"] = date.strftime("%y")
    res[prefix+"Y"] = date.strftime("%Y")
    res[prefix+"Z"] = date.strftime("%Z")

    for i, value in res.items():
        res[i] = locale_to_utf8(value)

    return res
2874
def concat(self, other_datatable, inplace=False):
        
        if not isinstance(other_datatable, DataTable):
            raise TypeError("`concat` requires a DataTable, not a %s" %
                            type(other_datatable))

        # if the self table is empty, we can just return the other table
        # if we need to do it in place, we just copy over the columns
        if not self.fields:
            if inplace:
                for field in other_datatable.fields:
                    self[field] = other_datatable[field]
                return self
            else:
                return other_datatable
        if not other_datatable.fields:
            return self

        if set(self.fields) != set(other_datatable.fields):
            raise Exception("Columns do not match:\nself: %s\nother: %s" %
                            (self.fields, other_datatable.fields))

        # TODO: this will fail if we're concatenating one table with `arrays`
        # TODO: to a table with lists, even if everything else is compatible
        # TODO: a TypeError is thrown
        # TODO: if we run through and just append, this may be faster and
        # TODO: more memory-efficient for large lists, as well as compatible
        # TODO: with arrays
        if inplace:
            for field in self.fields:
                self.__data[field] = self[field] + other_datatable[field]
            return self
        else:
            new_table = DataTable()
            for field in self.fields:
                new_table[field] = self[field] + other_datatable[field]
            return new_table
168106
def _normalize_date_SQL(self, field_name, field_kwargs, symbol):
        
        fstrs = []
        k_opts = {
            'day': "CAST(strftime('%d', {}) AS integer)",
            'hour': "CAST(strftime('%H', {}) AS integer)",
            'doy': "CAST(strftime('%j', {}) AS integer)", # day of year
            'julian_day': "strftime('%J', {})", # YYYY-MM-DD
            'month': "CAST(strftime('%m', {}) AS integer)",
            'minute': "CAST(strftime('%M', {}) AS integer)",
            'dow': "CAST(strftime('%w', {}) AS integer)", # day of week 0 = sunday
            'week': "CAST(strftime('%W', {}) AS integer)",
            'year': "CAST(strftime('%Y', {}) AS integer)"
        }

        for k, v in field_kwargs.items():
            fstrs.append([k_opts[k].format(self._normalize_name(field_name)), self.val_placeholder, v])

        return fstrs
1187679
def field_function(self, type_code, func_name):
        """"""
        assert func_name in ('to_json', 'from_json')
        name = "field_%s_%s" % (type_code.lower(), func_name)
        return getattr(self, name)
84720
def _parse_years(years):
    
    result = []
    for part in years.split(','):
        if '-' in part:
            a, b = part.split('-')
            a, b = int(a), int(b)
            result.extend(range(a, b + 1))
        else:
            a = int(part)
            result.append(a)
    return result
901660
def convertafield(field_comm, field_val, field_iddname):
    """"""
    convinidd = ConvInIDD()
    field_typ = field_comm.get('type', [None])[0]    
    conv = convinidd.conv_dict().get(field_typ, convinidd.no_type)
    return conv(field_val, field_iddname)
584910
def conv(self,field_name,conv_func):
        """"""
        if field_name not in self.fields:
            raise NameError,"Unknown field %s" %field_name
        self.conv_func[field_name] = conv_func
1283438
def concat(self, other, inplace=False):
        ''''''
        
        # Create new entity
        if inplace:
            obj = self
        else:
            obj = self.copy()
        
        # Stitch every attribute
        for name, attr in obj.__attributes__.items():
            attr.append(other.__attributes__[name])
            
        # Stitch every relation
        for name, rel in obj.__relations__.items():
            rel.append(other.__relations__[name])
        
        # Update maps
        
        # Update dimensions
        if obj.is_empty():
            obj.maps = {k: m.copy() for k, m in other.maps.items()}
            obj.dimensions = other.dimensions.copy()
        else:
            for (a, b), rel in obj.maps.items():
                rel.append(other.maps[a, b])
            for d in obj.dimensions:
                obj.dimensions[d] += other.dimensions[d]
        
        return obj
771385
private void mergeInstantFields() {
        if (fieldValues.containsKey(INSTANT_SECONDS)) {
            if (zone != null) {
                mergeInstantFields0(zone);
            } else {
                Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
                if (offsetSecs != null) {
                    ZoneOffset offset = ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
                    mergeInstantFields0(offset);
                }
            }
        }
    }
92323
function coerce (type, field, value) {
  let result
  if (type === 'string') {
    result = String(value).trim()
  } else if (type === 'number') {
    result = Number(value)
    if (isNaN(result)) throw new Error(`field ${field} can not be converted to a number`)
  } else if (type === 'array') {
    result = [].concat(value)
  } else if (type === 'date') {
    result = Date.parse(value)
    if (isNaN(result)) throw new Error(`field ${field} can not be converted into a date`)
  } else if (type === 'boolean') {
    result = Boolean(value)
  } else if (type === 'object') {
    if (typeof value !== 'object') throw new Error(`field ${field} is not an object`)
    result = value
  }
  return result
}