Log In    |    Knowledge Base    |    4D Home
Tech Tip: ViewPro Commands Optional Sheet Parameter
PRODUCT: 4D View Pro | VERSION: 19 | PLATFORM: Mac & Win
Published On: June 20, 2022

New features and commands to interact with 4D View Pro areas are being introduced regularly with each new version of 4D. One of the things to note about these commands are that many of them contain an optional parameter for specifying a sheet in the View Pro document.

As with other spreadsheet documents, 4D View Pro supports the implementation of multiple sheets in the document. With many of the commands, there is an optional sheet parameter that defaults to the "Current Sheet". The "Current Sheet" is the sheet that is currently displayed/active in the 4D View Pro area. To specify a different sheet, the sheet's index number should be specified for this parameter. The indexes of the sheet start from 0.

For example, when printing the third sheet (Index 2) of a 4D View Pro document, that has been loaded and defaults to displaying the first sheet (Index 0). If the VP SET PRINT INFO command is used without specifying the sheet, the print options will only get applied to the "Current Sheet" which was the first sheet.

VP SET PRINT INFO (vpArea; $obj_PrintInfo) // Will apply to "Current Sheet"

VP SET PRINT INFO (vpArea; $obj_PrintInfo; 2) // Will apply to the 3rd sheet (Index 2)

If 4D View Pro is planned to be used to build and interact documents with multiple sheets, it will be important to keep this in mind and specify the sheet to confirm correct behavior.