mapping different fields with the same EDT from different tables to each other.
For example let's that you have an a customer Table and a vendors table and
you want to fill in the fields of a new table from these tables.
If maps did not exist you would have to do this in your new table:
void initFromCustTable(CustTable _custTable)
{
this.AccountNum = _custTable.AccountNum;
this.Name = _custTable.Name;
this.country = _custTable.Country;
this.language = _custTable.Language;
}
AND
void initFromCustTable(VendTable _vendable)
{
this.AccountNum = _vendable.AccountNum;
this.Name = _vendable.Name;
this.country = _vendable.Country;
this.language = _vendable.Language;
}
BUT
if you use a map (mapping newTable, CustTable and Vendor) all you need is
this:
void initFromCustVendMap(CustVendMap _custVendMap)
{
this.AccountNum = _custVendMap.AccountNum;
this.Name = _custVendMap.Name;
this.country = _custVendMap.Country;
this.language = _custVendMap.Language;
}
ONLY once on the map and then you just call the same method with different
buffers:
this.initFromCustVendMap(YourCustTableBuffer);
this.initFromCustVendMap(YOurVendTableBuffer); // NOTE same method but
different buffer.
Some more Examples On Maps
The X++ Job Code
static void MapJob()
{
MapDevice mDevice;
TabClock tClock;
TabPhone tPhone;
;
// 1: Call the method as it is implemented on the map.
mDevice.doubleTheVoltage("Testing");
// 2: Twice, call a method that is defined in the AOT under MapDevice > Methods.
mDevice.getTheVoltage();
mDevice.MapDevice::getTheVoltage();
// 3: Activate the TabClock mapping on the map.
mDevice = tClock;
// 4: Set fields that are defined in the AOT under MapDevice > Fields.
mDevice.brandName = "Contoso";
mDevice.batteryVoltage3 = 9;
// 5: Call an inherited method. The toString method returns "Class xRecord".
print mDevice.toString();
// 6: Call a method that is defined in the AOT only under MapDevice > Methods.
mDevice.MapDevice::getTheVoltage();
// 7: Call the method as it is implemented on the table.
mDevice.doubleTheVoltage("Testing");
}
For example let's that you have an a customer Table and a vendors table and
you want to fill in the fields of a new table from these tables.
If maps did not exist you would have to do this in your new table:
void initFromCustTable(CustTable _custTable)
{
this.AccountNum = _custTable.AccountNum;
this.Name = _custTable.Name;
this.country = _custTable.Country;
this.language = _custTable.Language;
}
AND
void initFromCustTable(VendTable _vendable)
{
this.AccountNum = _vendable.AccountNum;
this.Name = _vendable.Name;
this.country = _vendable.Country;
this.language = _vendable.Language;
}
BUT
if you use a map (mapping newTable, CustTable and Vendor) all you need is
this:
void initFromCustVendMap(CustVendMap _custVendMap)
{
this.AccountNum = _custVendMap.AccountNum;
this.Name = _custVendMap.Name;
this.country = _custVendMap.Country;
this.language = _custVendMap.Language;
}
ONLY once on the map and then you just call the same method with different
buffers:
this.initFromCustVendMap(YourCustTableBuffer);
this.initFromCustVendMap(YOurVendTableBuffer); // NOTE same method but
different buffer.
Some more Examples On Maps
The X++ Job Code
static void MapJob()
{
MapDevice mDevice;
TabClock tClock;
TabPhone tPhone;
;
// 1: Call the method as it is implemented on the map.
mDevice.doubleTheVoltage("Testing");
// 2: Twice, call a method that is defined in the AOT under MapDevice > Methods.
mDevice.getTheVoltage();
mDevice.MapDevice::getTheVoltage();
// 3: Activate the TabClock mapping on the map.
mDevice = tClock;
// 4: Set fields that are defined in the AOT under MapDevice > Fields.
mDevice.brandName = "Contoso";
mDevice.batteryVoltage3 = 9;
// 5: Call an inherited method. The toString method returns "Class xRecord".
print mDevice.toString();
// 6: Call a method that is defined in the AOT only under MapDevice > Methods.
mDevice.MapDevice::getTheVoltage();
// 7: Call the method as it is implemented on the table.
mDevice.doubleTheVoltage("Testing");
}
No comments:
Post a Comment