Support Board
Date/Time: Wed, 27 Nov 2024 10:47:58 +0000
[Programming Help] - Spreadsheet interaction ACSIL
View Count: 325
[2023-09-02 19:15:49] |
User373245 - Posts: 42 |
#include "sierrachart.h" SCDLLName("Data Collection 2") SCSFExport scsf_DataCollection2(SCStudyInterfaceRef sc) { // Set input reference subgraphs SCSubgraphRef Subgraph_SignalState = sc.Subgraph[0]; SCInputRef Input_SpreadsheetName = sc.Input[1]; SCInputRef Input_240StnAngle = sc.Input[2]; SCInputRef Input_LongSignalSelection = sc.Input[20]; SCInputRef Input_ShortSignalSelection = sc.Input[21]; // Set input variables to be stored in arrays SCFloatArrayRef Array_LongSignal = Subgraph_SignalState.Arrays[0]; SCFloatArrayRef Array_ShortSignal = Subgraph_SignalState.Arrays[1]; SCFloatArrayRef Array_240StnAngle = Subgraph_SignalState.Arrays[2]; if (sc.SetDefaults) { sc.GraphName = "Data Collection 2"; sc.AutoLoop = 1; Input_SpreadsheetName.Name= "Data Collection 2"; Input_SpreadsheetName.SetString(""); Subgraph_SignalState.Name = "Standard deviation line angle"; Subgraph_SignalState.DrawStyle = DRAWSTYLE_LINE; Input_LongSignalSelection.Name = "Select Long Signal"; Input_LongSignalSelection.SetChartStudySubgraphValues(17, 71, 0); Input_ShortSignalSelection.Name = "Select Short Signal"; Input_ShortSignalSelection.SetChartStudySubgraphValues(17, 72, 0); Input_240StnAngle.Name = "240 STN Val"; Input_240StnAngle.SetChartStudySubgraphValues(17, 73, 0); return; } // Create the long short logic as an array (this is my alert condition) SCFloatArray LongArray; sc.GetStudyArrayUsingID(Input_LongSignalSelection.GetStudyID(), Input_LongSignalSelection.GetSubgraphIndex(), LongArray); if (LongArray.GetArraySize() == 1) return; SCFloatArray ShortArray; sc.GetStudyArrayUsingID(Input_ShortSignalSelection.GetStudyID(), Input_ShortSignalSelection.GetSubgraphIndex(), ShortArray); if (ShortArray.GetArraySize() == -1) return; // Define and initialize any other arrays or subgraphs here // Set LongSignal and ShortSignal to true bool LongSignal = true; bool ShortSignal = true; if ((LongSignal || ShortSignal) && Subgraph_SignalState[sc.Index] == 0) { const char* SheetCollectionName = Input_SpreadsheetName.GetString(); const char* SheetCollectionName = "Data Collection 2"; const char* SheetName = "Sheet 17"; int CreateSheetIfNotExist = 1; void* SheetHandle = GetSpreadsheetSheetHandleByName(SheetCollectionName, SheetName, CreateSheetIfNotExist); sc.GetStudyArrayFromChartUsingID(Input_240StnAngle.GetChartStudySubgraphValues(), Array_240StnAngle); Subgraph_SignalState[sc.Index] = 1; } return; } CollectionData.cpp: In function 'void scsf_DataCollection2(SCStudyInterfaceRef)': CollectionData.cpp:65:15: error: redeclaration of 'const char* SheetCollectionName' 65 | const char* SheetCollectionName = "Data Collection 2"; | ^~~~~~~~~~~~~~~~~~~ CollectionData.cpp:64:15: note: 'const char* SheetCollectionName' previously declared here 64 | const char* SheetCollectionName = Input_SpreadsheetName.GetString(); | ^~~~~~~~~~~~~~~~~~~ CollectionData.cpp:68:23: error: 'GetSpreadsheetSheetHandleByName' was not declared in this scope 68 | void* SheetHandle = GetSpreadsheetSheetHandleByName(SheetCollectionName, SheetName, CreateSheetIfNotExist); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- End of Build -- 19:10:28 Not sure how to go about the spreadsheet interaction. My spreadsheet is saved as Data Collection 2 and I am using sheet 17. But getting this error |
[2023-09-03 10:06:28] |
User431178 - Posts: 544 |
CollectionData.cpp:65:15: error: redeclaration of 'const char* SheetCollectionName' const char* SheetCollectionName = Input_SpreadsheetName.GetString(); const char* SheetCollectionName = "Data Collection 2"; Delete one of the above lines. CollectionData.cpp:68:23: error: 'GetSpreadsheetSheetHandleByName' was not declared in this scope this void* SheetHandle = GetSpreadsheetSheetHandleByName(SheetCollectionName, SheetName, CreateSheetIfNotExist); should be void* SheetHandle = sc.GetSpreadsheetSheetHandleByName(SheetCollectionName, SheetName, CreateSheetIfNotExist); sc.GetSpreadsheetSheetHandleByName() |
To post a message in this thread, you need to log in with your Sierra Chart account: