I've been able to get the first example to work as I wanted. I don't know if it is the best solution but I'll place it here so you can use it if you're facing the same problem.
Basically I've mapped the values to hidden fields and then I change the content of the displayfield according to the value on myHidden
mapping: ['myHidden''mapping1','mapping2'],
form: [{
fieldLabel: 'mapping1',
xtype: 'hidden',
id: 'mapping1',
},{
fieldLabel: 'mapping2',
xtype: 'hidden',
id: 'mapping2',
},{
fieldLabel: 'myHidden',
xtype: 'hidden',
name: 'myHidden',
listeners: {
'change': function(){
if(this.getValue=='X'){
Ext.getCmp('myText').setValue(Ext.getCmp('mapping1').getValue());
}
else{
Ext.getCmp('myText').setValue(Ext.getCmp('mapping2').getValue());
}
}
}
},{
fieldLabel: 'myText',
xtype: 'displayfield',
id: 'myText'
}]