 import weave.utils.EquationColumnLib;
 import weave.api.data.DataTypes;
 import weave.compiler.ProxyObject;
-
-internal class TransposedRecord implements IAttributeColumn, IDisposableObject
+import weave.api.data.IPrimitiveColumn;
+import weave.compiler.StandardLib;
+import weave.compiler.Compiler;
+import weave.api.reportError;
+
+internal class TransposedRecord implements IAttributeColumn, IDisposableObject, IPrimitiveColumn
 {
 	private var dataSource:TransposedDataSource;
 	private var columnCallbacks:ICallbackCollection;
 	private var internalData:InternalData;
 	private var callbacks:ICallbackCollection;
-	private var originalKey:IQualifiedKey;
-	private var metadataName:String;
-	
-	public function TransposedRecord(dataSource:TransposedDataSource, internalData:InternalData, originalKey:IQualifiedKey, metadataName:String)
+	private var sourceKey:IQualifiedKey;
+	private var sourceMetadataName:String;
+	
+	public function TransposedRecord(dataSource:TransposedDataSource, internalData:InternalData, sourceKey:IQualifiedKey, metadataName:String)
 	{
 		registerDisposableChild(dataSource, this);
 		

			{
				validateKeyType();

				var hierarchy:XML = <hierarchy title={ internalData.keyType }/>;
				
				var metaCategory:XML = <category title={ lang('Source column metadata') }/>;
				var propertyName:String;

	
	public function getMetadata(propertyName:String):String
	{
		// when columns change, reset cached metadata
		if (internalData.triggerCounter != columnCallbacks.triggerCounter)
		{
			internalData.triggerCounter = columnCallbacks.triggerCounter;
			internalData.sourceMetadataCache = {};
			internalData.deriveStringFromNumber = null;
		}
		
		// since this column is a transposed record, keyType is a custom value
		if (propertyName == ColumnMetadata.KEY_TYPE)
			return internalData.transposedKeyType;
		
		if (sourceMetadataName)
		{
			// metadata for transposed metadata columns
			if (propertyName == ColumnMetadata.TITLE)
				return propertyName;
			if (propertyName == ColumnMetadata.DATA_TYPE)
