Support Board
Date/Time: Fri, 29 Mar 2024 01:09:55 +0000
[User Discussion] - validity of GetSpreadsheetSheetHandleByName() result?
View Count: 673
[2021-01-10 14:15:53] |
ycomp - Posts: 274 |
How can I check that the result of GetSpreadsheetSheetHandleByName() is valid? I mean that there was indeed a spreadsheet and sheetname that matches what was requested? are there any other ways to check if a spreadsheet or sheet exists? also, is there a way to know if a spreadsheet is open? Date Time Of Last Edit: 2021-01-10 14:22:24
|
[2021-01-10 15:23:15] |
User907968 - Posts: 800 |
If there is no match, does the function not simply return null pointer? void* SheetHandle = sc.GetSpreadsheetSheetHandleByName(SheetCollectionName, SheetName, false); if (SheetHandle == nullptr) { // some code for no spreadsheet } else { // some different code for spreadsheet found } |
[2021-01-10 16:00:30] |
ycomp - Posts: 274 |
are you guessing or is that how it works? I tried this before positing but it didn't seem to work (I also tried checking for NULL and 0)
|
[2021-01-10 16:26:49] |
User907968 - Posts: 800 |
Checking for null pointer works fine for me
|
[2021-01-10 16:29:37] |
ycomp - Posts: 274 |
thanks i'll have to try it again out of curiousity, what didn't exist when you called the function? SheetCollectionName, SheetName or both?
Date Time Of Last Edit: 2021-01-10 16:30:20
|
[2021-01-10 16:38:30] |
ycomp - Posts: 274 |
I figured it out.. it only returns nullptr if the spreadsheet doesn't exist, if the sheet doesn't exist but the spreadsheet does then it won't return nullptr. Any idea how to check if a sheet exists? |
[2021-01-11 07:24:55] |
User907968 - Posts: 800 |
I just tested this and observe the same, a pointer is returned when the spreadsheet file exists, even if a non-existent sheet is requested. The spreadsheet manipulation functions, sc.GetSheetCellAsDouble() & sc.SetSheetCellAsDouble(), don't seem to be functioning as intended either, they both return 1 even when the pointer used is to a non-existent sheet. Maybe ask SC Engineering to investigate? |
[2021-01-11 09:20:22] |
ycomp - Posts: 274 |
I posted on this topic just now in the Support Board: ACSIL: Existence of Sheets in a Spreadsheet
Date Time Of Last Edit: 2021-01-11 09:20:47
|
To post a message in this thread, you need to log in with your Sierra Chart account: