Hi,
I have a problem when importing data entity with virtual fields.
I want to import data in next table:

You can see that it has relations with PMEBuilding (Ground etc) table using RefRecId and RefTableId. It also
The thing is that I want user to have in Excel BuildingId, GroundId etc. and not RefRecId.
So I created data entity and added unmapped fields ObjectId and ObjectType.
Export works fine, but when I try to import it keeps telling me:

I overridden ofcourse postLoad and mapEntityToDataSource methods:
public void postLoad()
{
super();
switch (this.RefTableId)
{
case tableNum(PMEGround):
this.ObjectType = PMEObjectType::Ground;
this.ObjectId = PMEGround::findRec(this.RefRecId).groundId;
break;
case tableNum(PMEBuilding):
this.ObjectType = PMEObjectType::Building;
this.ObjectId = PMEBuilding::findRec(this.RefRecId).buildingId;
break;
case tableNum(PMEParcel):
this.ObjectType = PMEObjectType::Parcel;
this.ObjectId = PMEParcel::findRec(this.RefRecId).parcelId;
break;
case tableNum(PMESection):
this.ObjectType = PMEObjectType::Section;
this.ObjectId = PMESection::findRec(this.RefRecId).sectionId;
this.Building = PMESection::findRec(this.RefRecId).buildingId;
break;
case tableNum(PMEZone):
this.ObjectType = PMEObjectType::Zone;
this.ObjectId = PMEZone::findRec(this.RefRecId).zoneId;
this.Building = PMEZone::findRec(this.RefRecId).buildingId;
this.Section = PMEZone::findRec(this.RefRecId).sectionId;
break;
}
public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
{
super(_entityCtx, _dataSourceCtx);
if (_dataSourceCtx.name() == dataEntityDataSourceStr(PMRealEstateOrganizationTypeEntity, PMGBuildingOrganizationType))
{
PMGBuildingOrganizationType realEstateOrgType = _dataSourceCtx.getBuffer();
switch (this.ObjectType)
{
case PMEObjectType::Ground:
realEstateOrgType.RefTableId = tableNum(PMEGround);
realEstateOrgType.RefRecId = PMEGround::find(this.ObjectId).RecId;
break;
case PMEObjectType::Building:
realEstateOrgType.RefTableId = tableNum(PMEBuilding);
realEstateOrgType.RefRecId = PMEBuilding::find(this.ObjectId).RecId;
break;
case PMEObjectType::Parcel:
realEstateOrgType.RefTableId = tableNum(PMEParcel);
realEstateOrgType.RefRecId = PMEParcel::find(this.ObjectId).RecId;
break;
case PMEObjectType::Section:
realEstateOrgType.RefTableId = tableNum(PMESection);
realEstateOrgType.RefRecId = PMESection::find(this.Building, this.ObjectId).RecId;
break;
case PMEObjectType::Zone:
realEstateOrgType.RefTableId = tableNum(PMEZone);
realEstateOrgType.RefRecId = PMEZone::find(this.Building, this.Section, this.ObjectId).RecId;
break;
}
}
But it DOESN'T help. Can someone help me?
Just note that RefTableID and RefRecId are part of primary key of this table which I am trying to import data.
Thanks in advance