title | description | author | ms.author | ms.topic | ms.custom | ms.date | ms.reviewer | ms.assetid | ms.search.region | ms.search.validFrom | ms.dyn365.ops.version | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Migrate Segmented Entry controls |
Learn about migration scenarios for the Segmented Entry control, including various X++ code examples and scenarios. |
RyanCCarlson2 |
rcarlson |
how-to |
|
06/19/2024 |
johnmichalak |
82e953d0-878e-4a3f-a91b-7375017a2810 |
Global |
2016-02-28 |
AX 7.0.0 |
[!include banner]
This tutorial walks you through two migration scenarios for the Segmented Entry control - a simple scenario (for the SMAServiceOrderTable form) and a complex scenario (for the LedgerJournalTransDaily form).
-
Search for the SMAServiceOrderTable form in Application Explorer.
-
Add the form to the current project.
-
Open the form in the form design view and the code editor view.
-
In the form design view, find the Segmented Entry control (SEC), either by manually walking the control tree or by searching for “SegmentedEntry” in the search bar below the File tab.
-
Select the SEC, and verify the following information:
- The type for the control, as specified in parenthesis next to the control, is SegmentedEntryControl.
- The Controller class property is set to DimensionDynamicAccountController. This property indicates the type of controller that this instance of the SEC will use. The type of controller, in turn, determines the behavior of the control.
-
Switch to the code editor view, and search for all occurrences of “TODO: (Code Upgrade) [Segmented entry control]” in the form source code.
-
In the search results, ignore the first result, which points to the controller variable declaration. You must fix this TODO last, after you've removed all references to the controller variable.
-
Go through each of the remaining TODO comments, as described in the following subsections.
(Form > Data sources > SMAServiceOrderLine > Fields > LedgerDimension > Methods)
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
ExpenseCost_LedgerDimension.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
(Search for "ExpenseCost_LedgerDimension" in the search bar below the Form tab.)
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
ExpenseCost_LedgerDimension.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't performing any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void loadSegments()
{
super();
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimDynamicAccountController.loadSegments();
}
Because this method only calls the loadSegments() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] Fix controller usage, if any, in this method based on the migration guidance */
public void lookup()
{
switch (smaServiceOrderLine.OffsetAccountTypeExpense)
{
case LedgerJournalACType::Bank:
BankAccountTable::lookupBankAccount(this);
break;
case LedgerJournalACType::Cust:
CustTable::lookupCustomer(this);
break;
case LedgerJournalACType::FixedAssets:
AssetTable::lookupAccountNum(this);
break;
case LedgerJournalACType::Project:
ProjTable::lookupProjId(this, smaServiceOrderLine);
break;
case LedgerJournalACType::Vend:
VendTable::lookupVendor(this);
break;
default:
super();
break;
}
}
This method implements a custom lookup for the control. Therefore, leave the method as it is. Just remove the TODO. To hook up custom lookups, you must override the SEC’s checkUseCustomLookup method. Here is an example.
public boolean checkUseCustomLookup(int _accountTypeEnumValue, int _secondaryAccountTypeEnumValue)
{
boolean ret;
switch(_accountTypeEnumValue)
{
case LedgerJournalACType::Bank:
case LedgerJournalACType::Cust:
case LedgerJournalACType::FixedAssets:
case LedgerJournalACType::Project:
case LedgerJournalACType::Vend:
ret = true;
break;
default:
ret = false;
}
return ret;
}
Additionally, make sure that the closeSelectRecord method on the custom lookup form is overridden. For an example, see the CustTableLookup form.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
super(_e);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimDynamicAccountController.segmentValueChanged(_e);
}
Because this method only calls the segmentValueChanged() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public boolean validate()
{
boolean isValid;
isValid = super();
/* TODO: (Code Upgrade) [Segmented entry control] This statement can be removed if there is no custom logic */
// isValid = dimDynamicAccountController.validate() && isValid;
return isValid;
}
Because this method only calls the validate() method on the control and doesn't perform any additional processing, you can delete it.
Finally, go back to the first TODO, for the controller variable declaration.
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
/* 'dimDynamicAccountController' controller object is used with 'ExpenseCost_LedgerDimension' segmented entry controls.*/
DimensionDynamicAccountController dimDynamicAccountController;
The dimDynamicAccountController variable is no longer used on the form. Therefore, you can now delete it.
-
Search for the LedgerJournalTransDaily form in Application Explorer.
-
Add the form to the current project.
-
Open the form in the form design view and the code editor view.
-
In the form design view, find the SEC, either by manually walking the control tree or by searching for “SegmentedEntry” in the search bar below the File tab.
-
Select the SEC, and verify the following information:
- The type for the control, as specified in parenthesis next to the control, is SegmentedEntryControl.
- The Controller class property is set to DimensionDynamicAccountController. This property indicates the type of controller that this instance of the SEC will use. The type of controller, in turn, determines the behavior of the control.
-
Switch to the code editor view, and search for all occurrences of “TODO: (Code Upgrade) [Segmented entry control]” in the form source code.
-
In the search results, the first three results are for the controller variable declarations. Look at the comments that accompany the TODOs, and make a note of the mapping that shows which SEC instance uses which controller instance. You will need this mapping when you replace method calls on the controller with method calls on the control. Here is what the controller-to-control mapping looks like:
-
dimAccountController
- LedgerJournalTrans_AccountNum
- LedgerJournalTrans_AccountNum1
- Group4_AccountNum
-
dimOffsetAccountController
- GridOffsetAccount
- LedgerJournalTrans_OffsetAccount1
- Group4_OffsetAccount
-
dimPaymentFeeAccountController
- CustPaymJournalFee_CustAccount
You will fix these three TODO comments at the end, after you've removed all references to the controller variables.
-
-
Go through each of the remaining TODO comments, as described in the following subsections.
(Form > Data sources > LedgerJournalTrans > Fields > LedgerDimension > Methods)
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
// </GEEPL>
public void jumpRef()
{
LedgerJournalTrans_AccountNum.jumpRef();
LedgerJournalTrans_AccountNum1.jumpRef();
Group4_AccountNum.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
(Form > Data sources > LedgerJournalTrans > Fields > OffsetLedgerDimension > Methods)
The OffsetLedgerDimension field’s jumpRef() method:
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
GridOffsetAccount.jumpRef();
LedgerJournalTrans_OffsetAccount1.jumpRef();
Group4_OffsetAccount.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
(Search for "LedgerJournalTrans_AccountNum" in the search bar below the Form tab.)
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
LedgerJournalTrans_AccountNum.jumpRef();
LedgerJournalTrans_AccountNum1.jumpRef();
Group4_AccountNum.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void loadSegments()
{
super();
LedgerJournalTrans_AccountNum.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_AccountNum1.parmJournalName(ledgerJournalTable.JournalName);
Group4_AccountNum.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_AccountNum1.parmCurrency(ledgerJournalTrans.CurrencyCode);
Group4_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
LedgerJournalTrans_AccountNum1.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
Group4_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
LedgerJournalTrans_AccountNum.parmControlDate(ledgerJournalTrans.TransDate);
LedgerJournalTrans_AccountNum1.parmControlDate(ledgerJournalTrans.TransDate);
Group4_AccountNum.parmControlDate(ledgerJournalTrans.TransDate);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimAccountController.loadSegments();
currentMainAccountId = dimAccountController.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount));
}
-
Update the initLedger() method.
void initLedger() { TransDate dateFrom = dateNull(); TransDate dateTo = systemDateGet(); if (element.args().dataset() == tableNum(LedgerJournalTable)) { ledgerJournalTable = element.args().record(); journalNum = ledgerJournalTable.JournalNum; LedgerJournalTrans_AccountNum.parmJournalName(ledgerJournalTable.JournalName); LedgerJournalTrans_AccountNum1.parmJournalName(ledgerJournalTable.JournalName); Group4_AccountNum.parmJournalName(ledgerJournalTable.JournalName); . . .
-
Update the code in the LedgerJournalTrans data source’s active() method. Note: The getValue() method should be called only if the account type is set to Ledger. Otherwise, a call to this method will cause an invalid function call.
. . . LedgerJournalTrans_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode); LedgerJournalTrans_AccountNum1.parmCurrency(ledgerJournalTrans.CurrencyCode); Group4_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode); LedgerJournalTrans_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext()); LedgerJournalTrans_AccountNum1.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext()); Group4_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext()); LedgerJournalTrans_AccountNum.parmControlDate(ledgerJournalTrans.TransDate); LedgerJournalTrans_AccountNum1.parmControlDate(ledgerJournalTrans.TransDate); Group4_AccountNum.parmControlDate(ledgerJournalTrans.TransDate); if (ledgerJournalTrans.AccountType == LedgerJournalACType::Ledger) { currentMainAccountId = LedgerJournalTrans_AccountNum.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentMainAccountId = 0; } return ret;
-
Add the following code to the modified() method of the LedgerJournalTrans data source’s CurrencyCode field.
LedgerJournalTrans_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode); LedgerJournalTrans_AccountNum1.parmCurrency(ledgerJournalTrans.CurrencyCode); Group4_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode);
-
Add the following code to the modified() method of the LedgerJournalTrans data source’s Company field.
LedgerJournalTrans_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext()); LedgerJournalTrans_AccountNum1.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext()); Group4_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
-
Add the following code to the modified() method of the LedgerJournalTrans data source’s TransDate field.
LedgerJournalTrans_AccountNum.parmControlDate(ledgerJournalTrans.TransDate); LedgerJournalTrans_AccountNum1.parmControlDate(ledgerJournalTrans.TransDate); Group4_AccountNum.parmControlDate(ledgerJournalTrans.TransDate);
-
Delete the loadSegments() method.
/* TODO: (Code Upgrade) [Segmented entry control] Fix controller usage, if any, in this method based on the migration guidance */
public void lookup()
{
// Polish sale disposal may require to filter asset that are not
// marked for sale. lookupAccountNum method needs the ledgerJournalTrans_Asset.TransType
// value to filter appropriately the assets. Thus, ledgerJournalTrans_Asset is
// passed to accountNumLookup metho jumpRef d.
// <GEEPL>
if (!ledgerJournalEngine.accountNumLookup(ledgerJournalTrans_AccountNum,
ledgerJournalTrans,
ledgerJournalTrans.OffsetAccountType,
ledgerJournalTrans.parmOffsetAccount(),
ledgerJournalTrans_Asset))
{
super();
}
// </GEEPL>
}
This method implements a custom lookup for the control. Therefore, leave the method as it is. Just remove the TODO. To hook up custom lookups, you must override the SEC’s checkUseCustomLookup method. Additionally, make sure that the closeSelectRecord method on the custom lookup form is overridden. For an example, see the CustTableLookup form.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
// <GIN>
if (TaxWithholdParameters_IN::checkTaxParameters()
&& ledgerJournalTrans.TaxWithholdCode_IN != '')
{
if (Box::okCancel("@GLS222698",
DialogButton::Cancel) == DialogButton::Cancel)
{
return;
}
}
// </GIN>
super(_e);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimAccountController.segmentValueChanged(_e);
currentMainAccountId = ledgerJournalEngine.onPrimaryAccountSegmentChanged(dimAccountController, currentMainAccountId, ledgerJournalTrans);
}
-
Override the onSegmentChanged() method on the control, and add the following code to it.
/// <summary> /// Event handler for the segment changed event. /// </summary> /// <param name = "_segment">The segment that has been changed.</param> public void onSegmentChanged(DimensionControlSegment _segment) { super(_segment); // <GIN> if (TaxWithholdParameters_IN::checkTaxParameters() && ledgerJournalTrans.TaxWithholdCode_IN != '') { if (Box::okCancel("@GLS222698", DialogButton::Cancel) == DialogButton::Cancel) { return; } } // </GIN> if (_segment.parmName() == mainAccountDimAttrName) { previousMainAccountId = currentMainAccountId; } currentMainAccountId = ledgerJournalEngine.onPrimaryAccountSegmentChanged(LedgerJournalTrans_AccountNum, currentMainAccountId, ledgerJournalTrans); }
-
Delete the segmentValueChanged() method. Note: The preceding code for the onSegmentChanged() method will not compile, because the onPrimaryAccountSegmentChanged() method expects a controller object, but this code passes an instance of the SEC. To call methods on the control instance, you must change the method’s signature and its implementation accordingly. This method is used by more than 50 callers. Therefore, you would also have to update all those calls. Alternatively, you can add a new method that follows this guidance.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public boolean validate()
{
boolean isValid;
isValid = super();
/* TODO: (Code Upgrade) [Segmented entry control] This statement can be removed if there is no custom logic */
// isValid = dimAccountController.validate() && isValid;
return isValid;
}
Because this method only calls the validate() method on the control and doesn't perform any additional processing, you can delete it.
(Search for "GridOffsetAccount" in the search bar below the Form tab.)
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
void gotFocus()
{
super();
if (ledgerJournalTable.FixedOffsetAccount)
{
gridOffsetAccount.allowEdit(ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger);
}
else if (!gridOffsetAccount.allowEdit())
{
gridOffsetAccount.allowEdit(true);
}
}
-
Add the following code to the initLedger() method, after the code that updates the ledgerJournalTable buffer.
. . . if (element.args().dataset() == tableNum(LedgerJournalTable)) { ledgerJournalTable = element.args().record(); journalNum = ledgerJournalTable.JournalNum; LedgerJournalTrans_AccountNum.parmJournalName(ledgerJournalTable.JournalName); LedgerJournalTrans_AccountNum1.parmJournalName(ledgerJournalTable.JournalName); Group4_AccountNum.parmJournalName(ledgerJournalTable.JournalName); if (ledgerJournalTable.FixedOffsetAccount) { gridOffsetAccount.allowEdit(ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger); } else if (!gridOffsetAccount.allowEdit()) { gridOffsetAccount.allowEdit(true); } . . .
-
Delete the gotFocus() method.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
GridOffsetAccount.jumpRef();
LedgerJournalTrans_OffsetAccount1.jumpRef();
Group4_OffsetAccount.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void loadSegments()
{
super();
GridOffsetAccount.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_OffsetAccount1.parmJournalName(ledgerJournalTable.JournalName);
Group4_OffsetAccount.parmJournalName(ledgerJournalTable.JournalName);
GridOffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_OffsetAccount1.parmCurrency(ledgerJournalTrans.CurrencyCode);
Group4_OffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode);
GridOffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
LedgerJournalTrans_OffsetAccount1.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
Group4_OffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
GridOffsetAccount.parmControlDate(ledgerJournalTrans.TransDate);
LedgerJournalTrans_OffsetAccount1.parmControlDate(ledgerJournalTrans.TransDate);
Group4_OffsetAccount.parmControlDate(ledgerJournalTrans.TransDate);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimOffsetAccountController.loadSegments();
currentOffsetMainAccountId = dimOffsetAccountController.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount));
// Lock the main account segment if "Fixed offset account" is selected in Journal Names
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger)
{
GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
Group4_OffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
}
}
-
Update the initLedger() method. Note: The getValue() method should be called only if the account type is set to Ledger. Otherwise, a call to this method will cause an invalid function call.
void initLedger() { TransDate dateFrom = dateNull(); TransDate dateTo = systemDateGet(); if (element.args().dataset() == tableNum(LedgerJournalTable)) { ledgerJournalTable = element.args().record(); journalNum = ledgerJournalTable.JournalNum; GridOffsetAccount.parmJournalName(ledgerJournalTable.JournalName); LedgerJournalTrans_OffsetAccount1.parmJournalName(ledgerJournalTable.JournalName); Group4_OffsetAccount.parmJournalName(ledgerJournalTable.JournalName); if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); } . . .
-
Update the code in the LedgerJournalTrans data source’s active() method. Note: The getValue() method should be called only if the account type is set to Ledger. Otherwise, a call to this method will cause an invalid function call.
. . . GridOffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode); LedgerJournalTrans_OffsetAccount1.parmCurrency(ledgerJournalTrans.CurrencyCode); Group4_OffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode); GridOffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany()); LedgerJournalTrans_OffsetAccount1.parmDataAreaId(ledgerJournalTrans.getOffsetCompany()); Group4_OffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany()); GridOffsetAccount.parmControlDate(ledgerJournalTrans.TransDate); LedgerJournalTrans_OffsetAccount1.parmControlDate(ledgerJournalTrans.TransDate); Group4_OffsetAccount.parmControlDate(ledgerJournalTrans.TransDate); if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue( DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); } return ret;
-
Add the following code to the modified() method of the LedgerJournalTrans data source’s CurrencyCode field.
GridOffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode); LedgerJournalTrans_OffsetAccount1.parmCurrency(ledgerJournalTrans.CurrencyCode); Group4_OffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode);
-
Add the following code to the modified() method of the LedgerJournalTrans data source’s OffsetCompany field.
GridOffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany()); LedgerJournalTrans_OffsetAccount1.parmDataAreaId(ledgerJournalTrans.getOffsetCompany()); Group4_OffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
-
Add the following code to the modified() method of the LedgerJournalTrans data source’s TransDate field.
GridOffsetAccount.parmControlDate(ledgerJournalTrans.TransDate); LedgerJournalTrans_OffsetAccount1.parmControlDate(ledgerJournalTrans.TransDate); Group4_OffsetAccount.parmControlDate(ledgerJournalTrans.TransDate);
-
Add the following code to the modified() method of the LedgerJournalTrans data source’s OffsetAccountType field. Note: The getValue() method should be called only if the account type is set to Ledger. Otherwise, a call to this method cause an invalid function call.
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue( DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); }
-
Delete the loadSegments() method.
/* TODO: (Code Upgrade) [Segmented entry control] Fix controller usage, if any, in this method based on the migration guidance */
public void lookup()
{
// Find the current segment index value
int currentSegmentIndex = dimOffsetAccountController.parmControl().currentSegmentIndex();
if ((ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger &&
dimOffsetAccountController.getDimensionAttributeByControlIndex(currentSegmentIndex) != DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)) ||
!ledgerJournalEngine.offsetAccountNumLookUp(gridOffsetAccount, ledgerJournalTrans))
{
super();
}
}
This method implements a custom lookup for the control. Therefore, keep the method, but replace the controller with the control instance. In this case, because the method is overridden on the GridOffsetAccount control, even though dimOffsetAccountController was used for three different SEC instances (based on the mapping that is shown in the TODOs on controller variable declarations), we must replace the controller with only one SEC instance. Therefore, the code will look like this.
public void lookup()
{
// Find the current segment index value
int currentSegmentIndex = GridOffsetAccount.getCurrentSegmentIndex();
if ((ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger && GridOffsetAccount.getDimensionAttributeByControlIndex(currentSegmentIndex) != DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)) || !ledgerJournalEngine.offsetAccountNumLookUp(gridOffsetAccount, ledgerJournalTrans))
{
super();
}
}
To hook up custom lookups, you must override the SEC’s checkUseCustomLookup method. Additionally, make sure that the closeSelectRecord method on the custom lookup form is overridden. For an example, see the CustTableLookup form.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
super(_e);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimOffsetAccountController.segmentValueChanged(_e);
currentOffsetMainAccountId = ledgerJournalEngine.onOffsetAccountSegmentChanged(dimOffsetAccountController, currentOffsetMainAccountId, ledgerJournalTrans);
}
-
Override the onSegmentChanged() method on the control, and add the following code to it.
/// <summary> /// Event handler for the segment changed event. /// </summary> /// <param name = "_segment">The segment that was modified.</param> public void onSegmentChanged(DimensionControlSegment _segment) { super(_segment); currentOffsetMainAccountId = ledgerJournalEngine.onOffsetAccountSegmentChanged( GridOffsetAccount, currentOffsetMainAccountId, ledgerJournalTrans); }
-
Delete the segmentValueChanged() method. Note: The preceding code for the onSegmentChanged() method will not compile, because the onOffsetAccountSegmentChanged() method expects a controller object, but this code passes an instance of the SEC. To call methods on the control instance, you must change the method’s signature and its implementation accordingly. This method is used by more than 50 callers. Therefore, you would also have to update all those calls. Alternatively, you can add a new method that follows this guidance.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public boolean validate()
{
boolean isValid;
isValid = super();
/* TODO: (Code Upgrade) [Segmented entry control] This statement can be removed if there is no custom logic */
// isValid = dimOffsetAccountController.validate() && isValid;
return isValid;
}
Because this method only calls the validate() method on the control and doesn't perform any additional processing, you can delete it.
(Search for "LedgerJournalTrans_AccountNum1" in the search bar below the Form tab.)
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
LedgerJournalTrans_AccountNum.jumpRef();
LedgerJournalTrans_AccountNum1.jumpRef();
Group4_AccountNum.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void loadSegments()
{
super();
LedgerJournalTrans_AccountNum.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_AccountNum1.parmJournalName(ledgerJournalTable.JournalName);
Group4_AccountNum.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_AccountNum1.parmCurrency(ledgerJournalTrans.CurrencyCode);
Group4_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
LedgerJournalTrans_AccountNum1.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
Group4_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
LedgerJournalTrans_AccountNum.parmControlDate(ledgerJournalTrans.TransDate);
LedgerJournalTrans_AccountNum1.parmControlDate(ledgerJournalTrans.TransDate);
Group4_AccountNum.parmControlDate(ledgerJournalTrans.TransDate);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimAccountController.loadSegments();
currentMainAccountId = dimAccountController.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount));
}
The steps for migrating this method are the same as the steps for migrating the LedgerJournalTrans_AccountNum.loadSegments() method. Therefore, no additional steps are required. Delete this method.
/* TODO: (Code Upgrade) [Segmented entry control] Fix controller usage, if any, in this method based on the migration guidance */
public void lookup()
{
if (!ledgerJournalEngine.accountNumLookup(ledgerJournalTrans_AccountNum1, ledgerJournalTrans))
{
super();
}
}
This method implements a custom lookup for the control. Therefore, leave the method as it is. Just remove the TODO. To hook up custom lookups, you must override the SEC’s checkUseCustomLookup method. Additionally, make sure that the closeSelectRecord method on the custom lookup is overridden. For an example, see the CustTableLookup form.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
super(_e);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimAccountController.segmentValueChanged(_e);
currentMainAccountId = ledgerJournalEngine.onPrimaryAccountSegmentChanged(dimAccountController, currentMainAccountId, ledgerJournalTrans);
}
-
Override the onSegmentChanged() method on the control, and add the following code to it.
/// <summary> /// The event handler when a segment is modified. /// </summary> /// <param name = "_segment">The segment that was modified.</param> public void onSegmentChanged(DimensionControlSegment _segment) { super(_segment); currentMainAccountId = ledgerJournalEngine.onPrimaryAccountSegmentChanged( LedgerJournalTrans_AccountNum1, currentMainAccountId, ledgerJournalTrans); }
-
Delete the segmentValueChanged() method. Note: The preceding code for the onSegmentChanged() method will not compile, because the onPrimaryAccountSegmentChanged() method expects a controller object, but this code passes an instance of the SEC. To call methods on the control instance, you must change the method’s signature and its implementation accordingly. This method is used by more than 50 callers. Therefore, you would also have to update all of those calls. Alternatively, you can add a new method that follows this guidance.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public boolean validate()
{
boolean isValid;
isValid = super();
/* TODO: (Code Upgrade) [Segmented entry control] This statement can be removed if there is no custom logic */
// isValid = dimAccountController.validate() && isValid;
return isValid;
}
Because this method only calls the validate() method on the control and doesn't perform any additional processing, you can delete it.
(Search for "LedgerJournalTrans_OffsetAccount1" in the search bar below the Form tab.)
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
GridOffsetAccount.jumpRef();
LedgerJournalTrans_OffsetAccount1.jumpRef();
Group4_OffsetAccount.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void loadSegments()
{
super();
GridOffsetAccount.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_OffsetAccount1.parmJournalName(ledgerJournalTable.JournalName);
Group4_OffsetAccount.parmJournalName(ledgerJournalTable.JournalName);
GridOffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_OffsetAccount1.parmCurrency(ledgerJournalTrans.CurrencyCode);
Group4_OffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode);
GridOffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
LedgerJournalTrans_OffsetAccount1.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
Group4_OffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
GridOffsetAccount.parmControlDate(ledgerJournalTrans.TransDate);
LedgerJournalTrans_OffsetAccount1.parmControlDate(ledgerJournalTrans.TransDate);
Group4_OffsetAccount.parmControlDate(ledgerJournalTrans.TransDate);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimOffsetAccountController.loadSegments();
currentOffsetMainAccountId = dimOffsetAccountController.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount));
// Lock the main account segment if "Fixed offset account" is selected in Journal Names
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger)
{
GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
Group4_OffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
}
}
The migration steps for the GridOffsetAccount.loadSegments() method already made most of the changes that are required for this method. However, you must still make the following changes.
-
Add a line of code to the LedgerJournalTrans data source’s active method.
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue( DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); }
-
Make the same change in the modified() method of the LedgerJournalTrans data source’s OffsetAccountType field.
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); }
-
Make the same change in the initLedger() method.
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue( DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); }
-
Delete the loadSegments() method.
/* TODO: (Code Upgrade) [Segmented entry control] Fix controller usage, if any, in this method based on the migration guidance */
public void lookup()
{
// Find the current segment index value
int currentSegmentIndex = dimOffsetAccountController.parmControl().currentSegmentIndex();
if ((ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger &&
dimOffsetAccountController.getDimensionAttributeByControlIndex(currentSegmentIndex) != DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)) ||
!ledgerJournalEngine.offsetAccountNumLookUp(ledgerJournalTrans_OffsetAccount1, ledgerJournalTrans))
{
super();
}
}
This method implements a custom lookup for the control. Therefore, keep the method, but replace the controller with the control instance. In this case, because the method is overridden on the LedgerJournalTrans_OffsetAccount1 control, even though dimOffsetAccountController was used for three different SEC instances (based on the mapping that is shown in the TODOs on controller variable declarations), we must replace the controller with only one SEC instance. Therefore, the code will look like this.
public void lookup()
{
// Find the current segment index value
int currentSegmentIndex = LedgerJournalTrans_OffsetAccount1.getCurrentSegmentIndex();
if ((ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger && LedgerJournalTrans_OffsetAccount1.getDimensionAttributeByControlIndex(currentSegmentIndex) != DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)) || !ledgerJournalEngine.offsetAccountNumLookUp(ledgerJournalTrans_OffsetAccount1, ledgerJournalTrans))
{
super();
}
}
To hook up custom lookups, you must override the SEC’s checkUseCustomLookup method. Additionally, make sure that the closeSelectRecord method on the custom lookup form is overridden. For an example, see the CustTableLookup form.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
super(_e);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimOffsetAccountController.segmentValueChanged(_e);
currentOffsetMainAccountId = ledgerJournalEngine.onOffsetAccountSegmentChanged(dimOffsetAccountController, currentOffsetMainAccountId, ledgerJournalTrans);
}
-
Override the onSegmentChanged() method on the control, and add the following code to it.
/// <summary> /// The event handler when a segment is modified. /// </summary> /// <param name = "_segment">The segment that was modified.</param> public void onSegmentChanged(DimensionControlSegment _segment) { super(_segment); currentOffsetMainAccountId = ledgerJournalEngine.onOffsetAccountSegmentChanged( LedgerJournalTrans_OffsetAccount1, currentOffsetMainAccountId, ledgerJournalTrans); }
-
Delete the segmentValueChanged() method. Note: The preceding code for the onSegmentChanged() method will not compile, because the onOffsetAccountSegmentChanged() method expects a controller object, but this code passes an instance of the SEC. To call methods on the control instance, you must change the method’s signature and its implementation accordingly. This method is used by more than 50 callers. Therefore, you would also have to update all those calls. Alternatively, you can add a new method that follows this guidance.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public boolean validate()
{
boolean isValid;
isValid = super();
/* TODO: (Code Upgrade) [Segmented entry control] This statement can be removed if there is no custom logic */
// isValid = dimOffsetAccountController.validate() && isValid;
return isValid;
}
Because this method only calls the validate() method on the control and doesn't perform any additional processing, you can delete it.
(Search for "CustPaymJournalFee_CustAccount" in the search bar below the Form tab.)
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
CustPaymJournalFee_CustAccount.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void loadSegments()
{
super();
CustPaymJournalFee_CustAccount.parmJournalName(ledgerJournalTable.JournalName);
CustPaymJournalFee_CustAccount.parmCurrency(custVendPaymJournalFee.FeeCurrency);
CustPaymJournalFee_CustAccount.parmControlDate(ledgerJournalTrans.TransDate);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimPaymentFeeAccountController.loadSegments();
currentPaymentFeeMainAccountId = dimPaymentFeeAccountController.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount));
}
-
Update the initLedger() method.
ledgerJournalTable = element.args().record(); journalNum = ledgerJournalTable.JournalNum; LedgerJournalTrans_AccountNum.parmJournalName(ledgerJournalTable.JournalName); LedgerJournalTrans_AccountNum1.parmJournalName(ledgerJournalTable.JournalName); Group4_AccountNum.parmJournalName(ledgerJournalTable.JournalName); CustPaymJournalFee_CustAccount.parmJournalName(ledgerJournalTable.JournalName); . . .
-
Add the following code to the CustVendPaymJournalFee data source’s active() method. Note: The method doesn't exist, so you must override it.
CustPaymJournalFee_CustAccount.parmCurrency(custVendPaymJournalFee.FeeCurrency);
-
Add the following code to the modified() method of the CustVendPaymJournalFee data source’s FeeCurrency field. Note: The method doesn't exist, so you must override it.
CustPaymJournalFee_CustAccount.parmCurrency(custVendPaymJournalFee.FeeCurrency);
-
Add the following code to the LedgerJournalTrans data source’s active() method.
CustPaymJournalFee_CustAccount.parmControlDate(ledgerJournalTrans.TransDate);
-
Add the following code to the modified() method of the LedgerJournalTrans data source’s TransDate field.
CustPaymJournalFee_CustAccount.parmControlDate(ledgerJournalTrans.TransDate);
-
Delete the loadSegments() method.
/* TODO: (Code Upgrade) [Segmented entry control] Fix controller usage, if any, in this method based on the migration guidance */
public void lookup()
{
if (custVendPaymJournalFee.Module == ModuleCustVend::Cust)
{
if (custVendPaymJournalFee.LedgerJournalACType == LedgerJournalACType::Cust)
{
CustTable::lookupCustomer(this, ledgerJournalTrans.Company);
}
else if (custVendPaymJournalFee.LedgerJournalACType == LedgerJournalACType::Ledger)
{
super();
}
}
else if (custVendPaymJournalFee.Module == ModuleCustVend::Vend)
{
if (custVendPaymJournalFee.LedgerJournalACType == LedgerJournalACType::Vend)
{
VendTable::lookupVendor(this, ledgerJournalTrans.Company);
}
else if (custVendPaymJournalFee.LedgerJournalACType == LedgerJournalACType::Ledger)
{
super();
}
}
}
This method implements a custom lookup for the control. Therefore, leave the method as it is. Just remove the TODO. To hook up custom lookups, you must override the SEC’s checkUseCustomLookup method. Here is an example.
public boolean checkUseCustomLookup(int _accountTypeEnumValue, int _secondaryAccountTypeEnumValue)
{
boolean ret;
switch(_accountTypeEnumValue)
{
case LedgerJournalACType::Bank:
case LedgerJournalACType::Cust:
case LedgerJournalACType::FixedAssets:
case LedgerJournalACType::Project:
case LedgerJournalACType::Vend:
ret = true;
break;
default:
ret = false;
}
return ret;
}
Additionally, make sure that the closeSelectRecord method on the custom lookup form is overridden. For an example, see the CustTableLookup form.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
super(_e);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimPaymentFeeAccountController.segmentValueChanged(_e);
currentPaymentFeeMainAccountId = ledgerJournalEngine.onPrimaryAccountSegmentChanged(dimPaymentFeeAccountController, currentPaymentFeeMainAccountId, ledgerJournalTrans);
}
-
Override the onSegmentChanged() method on the control, and add the following code to it.
/// <summary> /// The event handler when a segment is modified. /// </summary> /// <param name = "_segment">The segment that was modified.</param> public void onSegmentChanged(DimensionControlSegment _segment) { super(_segment); currentPaymentFeeMainAccountId = ledgerJournalEngine.onPrimaryAccountSegmentChanged( CustPaymJournalFee_CustAccount, currentPaymentFeeMainAccountId, ledgerJournalTrans); }
-
Delete the segmentValueChanged() method. Note: The preceding code for the onSegmentChanged() method will not compile, because the onPrimaryAccountSegmentChanged() method expects a controller object, but this code passes an instance of the SEC. To call methods on the control instance, you must change the method’s signature and its implementation accordingly. This method is used by more than 50 callers. Therefore, you would also have to update all those calls. Alternatively, you can add a new method that can follow this guidance.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public boolean validate()
{
boolean isValid;
isValid = super();
/* TODO: (Code Upgrade) [Segmented entry control] This statement can be removed if there is no custom logic */
// isValid = dimPaymentFeeAccountController.validate() && isValid;
return isValid;
}
Because this method only calls the validate() method on the control and doesn't perform any additional processing, you can delete it.
(Search for "Group4_AccountNum" in the search bar below the Form tab.)
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
LedgerJournalTrans_AccountNum.jumpRef();
LedgerJournalTrans_AccountNum1.jumpRef();
Group4_AccountNum.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void loadSegments()
{
super();
LedgerJournalTrans_AccountNum.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_AccountNum1.parmJournalName(ledgerJournalTable.JournalName);
Group4_AccountNum.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_AccountNum1.parmCurrency(ledgerJournalTrans.CurrencyCode);
Group4_AccountNum.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
LedgerJournalTrans_AccountNum1.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
Group4_AccountNum.parmDataAreaId(ledgerJournalTrans.Company ? ledgerJournalTrans.Company : curext());
LedgerJournalTrans_AccountNum.parmControlDate(ledgerJournalTrans.TransDate);
LedgerJournalTrans_AccountNum1.parmControlDate(ledgerJournalTrans.TransDate);
Group4_AccountNum.parmControlDate(ledgerJournalTrans.TransDate);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimAccountController.loadSegments();
currentMainAccountId = dimAccountController.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount));
}
The steps for migrating this method are the same as the steps for migrating the LedgerJournalTrans_AccountNum.loadSegments() method. Therefore, no additional steps are required. Delete this method.
/* TODO: (Code Upgrade) [Segmented entry control] Fix controller usage, if any, in this method based on the migration guidance */
public void lookup()
{
if (!ledgerJournalEngine.accountNumLookup(group4_AccountNum, ledgerJournalTrans))
{
super();
}
}
This method implements a custom lookup for the control. Therefore, leave the method as it is. Just remove the TODO. To hook up custom lookups, you must override the SEC’s checkUseCustomLookup method. Additionally, make sure that the closeSelectRecord method on the custom lookup form is overridden. For an example, see the CustTableLookup form.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
super(_e);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimAccountController.segmentValueChanged(_e);
currentMainAccountId = ledgerJournalEngine.onPrimaryAccountSegmentChanged(dimAccountController, currentMainAccountId, ledgerJournalTrans);
}
-
Override the onSegmentChanged() method on the control, and add the following code to it.
/// <summary> /// The event handler for the segment change event. /// </summary> /// <param name = "_segment">The segment that was modified.</param> public void onSegmentChanged(DimensionControlSegment _segment) { super(_segment); if (_segment.parmName() == mainAccountDimAttrName) { previousMainAccountId = currentMainAccountId; } currentMainAccountId = ledgerJournalEngine.onPrimaryAccountSegmentChanged(Group4_AccountNum, currentMainAccountId, ledgerJournalTrans); }
-
Delete the segmentValueChanged() method. Note: The preceding code for the onSegmentChanged() method will not compile, because the onPrimaryAccountSegmentChanged() method expects a controller object, but this code passes an instance of the SEC. To call methods on the control instance, you must change the method’s signature and its implementation accordingly. This method is used by more than 50 callers. Therefore, you would also have to update all those calls. Alternatively, you can add a new method that follows this guidance.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public boolean validate()
{
boolean isValid;
isValid = super();
/* TODO: (Code Upgrade) [Segmented entry control] This statement can be removed if there is no custom logic */
// isValid = dimAccountController.validate() && isValid;
return isValid;
}
Because this method only calls the validate() method on the control and doesn't perform any additional processing, you can delete it.
(Search for "Group4_OffsetAccount" in the search bar below the Form tab.)
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
void gotFocus()
{
super();
if (ledgerJournalTable.FixedOffsetAccount)
{
group4_OffsetAccount.allowEdit(ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger);
}
else if (!group4_OffsetAccount.allowEdit())
{
group4_OffsetAccount.allowEdit(true);
}
}
-
Update the code in the initLedger() method, after the code that updates the ledgerJournalTable buffer.
. . . if (ledgerJournalTable.FixedOffsetAccount) { gridOffsetAccount.allowEdit(ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger); group4_OffsetAccount.allowEdit(ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger); } else if (!gridOffsetAccount.allowEdit()) { gridOffsetAccount.allowEdit(true); group4_OffsetAccount.allowEdit(true); } . . .
-
Delete the gotFocus() method.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public void jumpRef()
{
GridOffsetAccount.jumpRef();
LedgerJournalTrans_OffsetAccount1.jumpRef();
Group4_OffsetAccount.jumpRef();
}
Because this method only calls the jumpRef() method on the control and doesn't perform any additional processing, you can delete it.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void loadSegments()
{
super();
GridOffsetAccount.parmJournalName(ledgerJournalTable.JournalName);
LedgerJournalTrans_OffsetAccount1.parmJournalName(ledgerJournalTable.JournalName);
Group4_OffsetAccount.parmJournalName(ledgerJournalTable.JournalName);
GridOffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode);
LedgerJournalTrans_OffsetAccount1.parmCurrency(ledgerJournalTrans.CurrencyCode);
Group4_OffsetAccount.parmCurrency(ledgerJournalTrans.CurrencyCode);
GridOffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
LedgerJournalTrans_OffsetAccount1.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
Group4_OffsetAccount.parmDataAreaId(ledgerJournalTrans.getOffsetCompany());
GridOffsetAccount.parmControlDate(ledgerJournalTrans.TransDate);
LedgerJournalTrans_OffsetAccount1.parmControlDate(ledgerJournalTrans.TransDate);
Group4_OffsetAccount.parmControlDate(ledgerJournalTrans.TransDate);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimOffsetAccountController.loadSegments();
currentOffsetMainAccountId = dimOffsetAccountController.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount));
// Lock the main account segment if "Fixed offset account" is selected in Journal Names
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger)
{
GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
Group4_OffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount);
}
}
The migration steps for the GridOffsetAccount.loadSegments() method already made most of the changes that are required for this method. However, you must still make the following changes.
-
Update the code in the LedgerJournalTrans data source’s active method.
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); Group4_OffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); }
-
Make the same change in the modified() method of the LedgerJournalTrans data source’s OffsetAccountType field.
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); Group4_OffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); }
-
Make the same change in the initLedger() method.
if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { currentOffsetMainAccountId = GridOffsetAccount.getValue(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)); } else { currentOffsetMainAccountId = 0; } // Lock the main account segment if "Fixed offset account" is selected in Journal Names if (ledgerJournalTrans.OffsetAccountType == LedgerJournalACType::Ledger) { GridOffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); LedgerJournalTrans_OffsetAccount1.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); Group4_OffsetAccount.parmLockMainAccountSegment(ledgerJournalTable.FixedOffsetAccount); }
-
Delete the loadSegments() method.
/* TODO: (Code Upgrade) [Segmented entry control] Fix controller usage, if any, in this method based on the migration guidance */
public void lookup()
{
if (!ledgerJournalEngine.offsetAccountNumLookUp(group4_OffsetAccount, ledgerJournalTrans))
{
super();
}
}
This method implements a custom lookup for the control. Therefore, leave the method as it is. Just remove the TODO. To hook up custom lookups, you must override the SEC’s checkUseCustomLookup method. Additionally, make sure that the closeSelectRecord method on the custom lookup form is overridden. For an example, see the CustTableLookup form.
/* TODO: (Code Upgrade) [Segmented entry control] For custom implementation, code in this method needs to be moved elsewhere based on the migration guidance */
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
super(_e);
/* TODO: (Code Upgrade) [Segmented entry control] Replace this based on the migration guidance */
// dimOffsetAccountController.segmentValueChanged(_e);
currentOffsetMainAccountId = ledgerJournalEngine.onOffsetAccountSegmentChanged(dimOffsetAccountController, currentOffsetMainAccountId, ledgerJournalTrans);
}
-
Override the onSegmentChanged() method on the control, and add the following code to it.
/// <summary> /// The event handler for the segment change event. /// </summary> /// <param name = "_segment">The segment that was modified.</param> public void onSegmentChanged(DimensionControlSegment _segment) { super(_segment); currentOffsetMainAccountId = ledgerJournalEngine.onOffsetAccountSegmentChanged( Group4_OffsetAccount, currentOffsetMainAccountId, ledgerJournalTrans); }
-
Delete the segmentValueChanged() method. Note: The preceding code for the onSegmentChanged() method will not compile, because the onOffsetAccountSegmentChanged() method expects a controller object, but this code passes an instance of the SEC. To call methods on the control instance, you must change the method’s signature and its implementation accordingly. This method is used by more than 50 callers. Therefore, you would also have to update all those calls. Alternatively, you can add a new method that follows this guidance.
/* TODO: (Code Upgrade) [Segmented entry control] This method can be removed if there is no custom implementation */
public boolean validate()
{
boolean isValid;
isValid = super();
/* TODO: (Code Upgrade) [Segmented entry control] This statement can be removed if there is no custom logic */
// isValid = dimOffsetAccountController.validate() && isValid;
return isValid;
}
Because this method only calls the validate() method on the control and doesn't perform any additional processing, you can delete it.
Support for Segmented Entry controls on dialogs
Design-time metadata for Segmented Entry controls
Parm methods for Segmented Entry controls
Migration guidance for Segmented Entry controls
[!INCLUDEfooter-include]