Spreadsheet Generation for Query Results Example

In this example, we will be creating a spreadsheet that can be called from the list screen after a query has been performed.  The spreadsheet will contain the results of the query.

This example requires that you completed the Screen Entity Example -Screen with Tabs section for the ITEM_MASTER_INQUIRY screen.

  1. First, we need to create a spreadsheet that contains a copy of the list block on the screen.

  2. Select the Group Information object.  Expand it, and select the group to which you wish to add the new spreadsheet entity.

  3. Right click on the group and select Create->Entity.

  4. Click on the Spreadsheet bullet.

  5. In the Entity Name property, enter ITEM_MASTER_INQ_SS

  6. Leave the Datasource set to (use default).

  7. Set the Based On property to SPREADSHEET_TEMPLATE.

  8. Set the Default Mode to Run Report.

  9. Leave the Body Style, Editable Field Style, Non-Editable Field Style, Lov Style, and Link Style properties set to (from parent).

  10. Click on the Finish button.  The new spreadsheet is added to the originally selected group.

  11. Click on the Save button in the main toolbar to save the new spreadsheet..  

  12. Expand the SCREENS group, and then expand the ITEM_MASTER_INQUIRY screen.

  13. Right click on the ITEMS_CONTAINER (list) block.

  14. Select Copy from the menu.

  15. Right click on the ITEM_MASTER_INQ_SS spreadsheet that you just created.

  16. Select Paste from the menu.

  17. The block is added to the spreadsheet.

  18. Click on the Save button in the main toolbar to save the changes.

  19. Now we need to create a button on the list mode of the ITEM_MASTER_INQUIRY screen that will generate the spreadsheet.

  20. With the ITEM_MASTER_INQUIRY screen expanded, select the ITEMS (qbe,list) block.

  21. Right click and select Create -> Label from the menu.

  22. Click on the Add button.

  23. In the field, enter SPREADSHEET.

  24. Click on the Add Fields button at the bottom of the screen.

  25. Expand the ITEMS (qbe,list) field and select the new SPREADSHEET field.  Display the property sheet.

  26. Set the Display As property to Button.

  27. In the Field Style property, select DEFAULT_BUTTON.

  28. In the Contents property, enter Generate Spreadsheet.

  29. Set the On QBE property to false.

  30. In the On Mouse Click property, enter ExecuteReportInNewWindow('ITEM_MASTER_INQ_SS');

  31. Click on the Save button in the main toolbar to save the changes.

  32. To test, select the ITEM_MASTER_INQUIRY screen, and click on the Run button in the main toolbar.

  33. The Preparing to Run pop-up is displayed.  Click on the Run button.

  34. The screen will be run in the browser.

  35. Enter some query information and select Execute Search on the left menu.

  36. The list is displayed.

  37. Click on the Generate Spreadsheet button to generate the spreadsheet.