ADF Desktop Integration (ADFDI) would not be so attractive and flexible if we could not parameterise data requests to limit data scope working on. Thus parameterising is must have feature and it might look not so straight forward how to leverage it. Because we need to set it up in several places all the way to application layer, where data is pulled via View Objects. I will use the same demo application created and step by step improved in related posts of How to create ADF Desktop Integration (ADFDI) Excel workbook. Here is guide how to add and use a parameter in ADFDI excel workbook:
- Setup application to support parameters passed from Excel workbook
- Add parameter in page definition file. In our demo application it’ll be managerId. We’re going to filter employees by their managers.
- Create view criteria with bind variable for managerId in employeesView view object.
- Modify EmployeesView in Application module by adding recently created view criteria
- Modify Execute action in page definition file by adding support for parameter which is passed to bind variable of view object. Execute action needs to be changed to ExecuteWithParams. ManagerId binding with dynamic expression execution needs to be chosen. Action binding name stays Execute.
2. Setup Excel workbook to receive and pass parameter to application binding layer
- Open Workbook properties. Go inside of Parameters.
- Click Add and enter parameter name. In our case it is managerId.
- Open Worksheet Properties. Go into Parameters.
- Click Add. In the right side tab go into Parameter and select managerId. Confirm all windows by clicking OK.
3. Testing. Redeploy application and click Run in excel workbook. Enter value for managerId and enjoy filtered data!
In ADFDI runtime used for production, parameters should be passed in a regular way like as it was simple webpage. Example:
//localhost:7101/ADFDIDemo/excel/adfdiWorkbook.xlsx?managerId=100
By following such kind of link, excel file would be downloaded with already injected managerId=100. Afterwards it can be opened from local file system anytime and it will always contain managerId already set.
Demo application can be downloaded here.
You might be also interested in related topics:
- How to install ADF Desktop Integration (ADFDI) plugin?
- How to create ADF Desktop Integration (ADFDI) Excel workbook
- How to configure ADF Desktop Integration (ADFDI) worksheet to load data automatically on opening?
ADF Version 12.2.1.0.0