Index: DefaultFeatureAttributeDescriptor.java
===================================================================
--- DefaultFeatureAttributeDescriptor.java	(revision 44258)
+++ DefaultFeatureAttributeDescriptor.java	(revision 44259)
@@ -33,8 +33,19 @@
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.cresques.cts.IProjection;
+import org.gvsig.expressionevaluator.Expression;
+import org.gvsig.expressionevaluator.ExpressionUtils;
+import org.gvsig.expressionevaluator.SymbolTable;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import static org.gvsig.fmap.dal.DataManager.DAL_FOREING_CODE;
+import static org.gvsig.fmap.dal.DataManager.DAL_FOREING_LABEL;
+import static org.gvsig.fmap.dal.DataManager.DAL_FOREING_TABLE;
 import org.gvsig.fmap.dal.DataStore;
 import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.StoresRepository;
+import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable;
+import org.gvsig.fmap.dal.feature.Feature;
 import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
 import org.gvsig.fmap.dal.feature.FeatureAttributeEmulator;
 import org.gvsig.fmap.dal.feature.FeatureAttributeGetter;
@@ -74,6 +85,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressWarnings("UseSpecificCatch")
 public class DefaultFeatureAttributeDescriptor implements
         FeatureAttributeDescriptor, Persistent, DynField_v2, DynField_LabelAttribute {
 
@@ -128,6 +140,8 @@
     }
 
     protected DefaultFeatureAttributeDescriptor(FeatureType type) {
+        this();
+//        LOGGER.info(String.format("Created FeatureAttributeDescriptor [%08x].", this.hashCode()));
         setFeatureType(type);
         this.allowNull = true;
         this.dataType = null;
@@ -155,7 +169,9 @@
     protected DefaultFeatureAttributeDescriptor(
             DefaultFeatureAttributeDescriptor other
         ) {
+        this();
         copyFrom(other);
+//        LOGGER.info(String.format("Created FeatureAttributeDescriptor [%08x] [%s] (copy).", this.hashCode(), this.name));
     }
     
     @Override
@@ -230,6 +246,7 @@
             this.typeRef = null;
         } else {
             this.typeRef = new WeakReference(type);
+//            LOGGER.info(String.format("FeatureAttributeDescriptor[%08x] set FeatureType [%08x], ref [%08x].", this.hashCode(), type.hashCode(), typeRef.hashCode()));
         }
     }
     
@@ -346,6 +363,7 @@
     }
     
     public FeatureAttributeDescriptor setName(String name) {
+//        LOGGER.info(String.format("FeatureAttributeDescriptor[%08x] set name [%s].", this.hashCode(), name));
         this.name = name;
         return this;
     }
@@ -735,6 +753,60 @@
 
     @Override
     public DynObjectValueItem[] getAvailableValues() {
+        if( this.availableValues == null ) {
+            if( StringUtils.isBlank(this.getDataProfileName()) ) {
+                return null;
+            }
+            if( !StringUtils.equalsIgnoreCase(
+                    this.getDataProfileName(), 
+                    DataManager.DAL_SELECTABLE_FOREING_KEY) 
+                    ) {
+                return null;
+            }
+            Tags theTags = this.getTags();
+            if( theTags==null ) {
+                return null;
+            }
+            String foreingLabel = theTags.getString(DAL_FOREING_LABEL, null);
+            if( StringUtils.isBlank(foreingLabel) ) {
+                return null;
+            }
+            String foreingTableName = theTags.getString(DAL_FOREING_TABLE, null);
+            if( StringUtils.isBlank(foreingTableName) ) {
+                return null;
+            }
+            String foreingCodeName = theTags.getString(DAL_FOREING_CODE, null);
+            if( StringUtils.isBlank(foreingCodeName) ) {
+                return null;
+            }
+            try {
+                DataManager dataManager = DALLocator.getDataManager();
+                StoresRepository repository = this.getStore().getStoresRepository();
+                FeatureStore store = (FeatureStore) repository.get(foreingTableName);
+                if( store == null ) {
+                    LOGGER.warn("Can't locate store '"+foreingTableName+"' to get available values of field '"+this.getName()+"'.");
+                    return null;
+                }
+                        
+                Expression labelExpression = ExpressionUtils.createExpression(foreingLabel);
+                FeatureSymbolTable featureSymbolTable = dataManager.createFeatureSymbolTable();
+                SymbolTable symbolTable = featureSymbolTable.createParent();
+                
+                int count = (int) store.getFeatureCount();
+                DynObjectValueItem[] values = new DynObjectValueItem[count];
+                int n = 0;
+                for (Feature feature : store.getFeatureSet()) {
+                    featureSymbolTable.setFeature(feature);
+                    Object code = feature.get(foreingCodeName);
+                    Object label = labelExpression.execute(symbolTable);
+                    values[n++] = new DynObjectValueItem(code, Objects.toString(label, Objects.toString(code, "##ERROR##")));
+                }
+                this.availableValues = values;
+            } catch (Exception ex) {
+                LOGGER.warn("Can't get values from table '" + foreingTableName + "' for field '" + this.getName() + "'.", ex);
+                return null;
+            }
+        }
         return this.availableValues;
     }
 
@@ -1225,7 +1297,9 @@
         if( this.typeRef==null ) {
             return null;
         }
-        return (FeatureType) this.typeRef.get();
+        FeatureType ftype = (FeatureType) this.typeRef.get();
+//        LOGGER.info(String.format("FeatureAttributeDescriptor[%08x] get FeatureType [%08x], ref [%08x].", this.hashCode(), ftype.hashCode(), typeRef.hashCode()));
+        return ftype;
     }
 
     public FeatureAttributeDescriptor setInterval(Interval interval) {
