Hi guys,
To provide you some context, I have a form AMDeviceTable in which i have displayed a field coming from a display method that was created under the AMDeviceTable table class extension, please see below:
// Display method to extract year from Date
[SysClientCacheDataMethodAttribute(true)]
display HERoutYear HERoutYear()
{
AMDeviceTableMaster deviceTableMaster;
[SysClientCacheDataMethodAttribute(true)]
display HERoutYear HERoutYear()
{
AMDeviceTableMaster deviceTableMaster;
// Get the current record's
deviceTableMaster = this.AMDeviceTableMaster();
deviceTableMaster = this.AMDeviceTableMaster();
// Check if DeRegistrationDate is available
if (deviceTableMaster.DeRegistrationDate)
{
return int2str(year(deviceTableMaster.DeRegistrationDate));
}
// If DeRegistrationDate is empty, check EndDate in AMRentDevice
else if (this.rentalEndDate())
{
return int2str(year(this.rentalEndDate()));
}
// If both DeRegistrationDate and EndDate are empty, check HerEstimatedRentEndDate in AMDeviceTable
else if (this.HerEstimatedRentEndDate)
{
return int2str(year(this.HerEstimatedRentEndDate));
}
Additionally, i wanted to expose this field on my data entity AMDeviceOverviewEntity. Therefore, i have created a virtual field and called my display method result under the postLoad() method on the entity (as stated in MS documentation). However, virtual fields do not allow filtering in Excel OData. After some research i found on MS documentation that i should use computed fields instead but i am not able to achive that goal. I tried the below code but i am getting a build error.
if (deviceTableMaster.DeRegistrationDate)
{
return int2str(year(deviceTableMaster.DeRegistrationDate));
}
// If DeRegistrationDate is empty, check EndDate in AMRentDevice
else if (this.rentalEndDate())
{
return int2str(year(this.rentalEndDate()));
}
// If both DeRegistrationDate and EndDate are empty, check HerEstimatedRentEndDate in AMDeviceTable
else if (this.HerEstimatedRentEndDate)
{
return int2str(year(this.HerEstimatedRentEndDate));
}
Additionally, i wanted to expose this field on my data entity AMDeviceOverviewEntity. Therefore, i have created a virtual field and called my display method result under the postLoad() method on the entity (as stated in MS documentation). However, virtual fields do not allow filtering in Excel OData. After some research i found on MS documentation that i should use computed fields instead but i am not able to achive that goal. I tried the below code but i am getting a build error.
str fldMyField = SysComputedColumn::returnField(tableStr(HERDeviceOverviewEntity),
tableStr(AMDeviceTable), methodStr(HERAMDeviceTableDbt_Extension, HERoutYear));
tableStr(AMDeviceTable), methodStr(HERAMDeviceTableDbt_Extension, HERoutYear));
return fldMyField;
Could you please help me fixing the issue?

Report
All responses (
Answers (