Tech Tip: Utility method to get a 4D View Pro sheet name in v19LTS
PRODUCT: 4D View Pro | VERSION: 19 | PLATFORM: Mac & Win
Published On: August 1, 2022
The command VP Get sheet name returns the name of sheet for a given index. This command was added in 19R2. For those who are still using v19LTS can use the following utility method to get a 4D View Pro sheet name.
// Method vpGetSheetName // $1 - Object (View Pro object) or Text (View Pro name) // $2 - Sheet index starting from 0 // // This method can be replaced by VP Get sheet name(vpAreaName;sheetIndex) in 19R #DECLARE($vp : Variant; $index : Integer)->$sheetName_t : Text var $vp_o : Object Case of : (Value type($vp)=Is text) $vp_o:=VP Export to object($vp) : (Value type($vp)=Is object) $vp_o:=$vp End case If ($vp_o.spreadJS.sheets#Null) ARRAY TEXT($proName_at; 0) OB GET PROPERTY NAMES($vp_o.spreadJS.sheets; $proName_at) If (Count parameters>=2) If (Size of array($proName_at)>$index) $sheetName_t:=$proName_at{$index+1} End if Else $sheetName_t:=$proName_at{1} End if End if |
Call example:
$vpSheetName_t:=vpGetSheetName("vpAreaName"; 0) // first sheet $vpSheetName_t:=vpGetSheetName("vpAreaName"; 1) // second sheet |
$vp_o:=VP Export to object("vpAreaName") $vpSheetName_t:=vpGetSheetName($vp_o; 0) // first sheet $vpSheetName_t:=vpGetSheetName($vp_o; 1) // second sheet |