Custom FEC (Field Edit control) control in Accpac SDK

By | September 23, 2011
Scenario:
I am needed to design a Report User Interface; one of the parameters within the report is “Quarter Selection”.
As you may be aware of the Field edit control is always bound to any data source which fetches the value which are displayed within the FEC. But to my concern I don’t have any such field available in my data source which will
display the Quarters list. I am stuck; as I want this selection parameter on my Report UI and as well can’t modify the Database to include this additional field. Please help me out in working out the solution.
Answer:
We can definitely create the disconnected FEC also termed as Custom FEC control. Custom FEC provides same set of properties and methods as FEC control. Basically, custom FEC is disconnected from Data source so will not be able to
get the properties and method at design time, but runtime only. You can use the Custom FEC as combo box, finder, list box, Check box, date time picker etc. Just check the below screen shot you can find the drop down list for Quarter, which is nothing but the Custom FEC.
Technical Approach:
You need to declare that FEC control as Accpac custom control with the events. To aid an application in controlling the custom FEC data, the custom FEC raises some events. If the application wants to handle these events, the custom FEC must be declared as “WithEvents” member variable. Kindly check the below snippet of code guiding through the
declaration/usage of the code.
Declaration:
Private WithEvents customFecRptType
As AccpacCustomField

Private CustomPresentationStr_RptType
As IAccpacCustomFieldPresentsStrings

Code Snippet:
Set customFecRptType = New AccpacCustomField

With customFecRptType
.PutSize 6
.PutDescription “Select
Quarter”
.PutPresentationType
(FLD_PRESENTS_LIST)
.PutType (FLD_CHAR)
Set customPresentationStr_RptType
= .PresentationStrings
customPresentationStr_RptType.Append “1”, “Jan -Mar”
customPresentationStr_RptType.Append “2”, “Apr -Jun”
customPresentationStr_RptType.Append “3”, “Jul -Sep”
customPresentationStr_RptType.Append “4”, “Oct -Dec”
End With ‘with customFecRptType

Set fecQuarterSelector.AccpacField = customFecRptType