Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 12:50:00 +0000



[Programming Help] - sc.Subgraph[].Name returns sc.Subgraph[].ShortName

View Count: 207

[2023-12-05 11:31:27]
User462086 - Posts: 196
Hello SC. Using v2533. How can a study consistently access a subgraph's name?

Please refer to lines 3 & 4 of test study output:


#include "sierrachart.h"

SCDLLName("Test_SubgraphNameShortName")

SCSFExport scsf_Test_SubgraphNameShortName(SCStudyInterfaceRef sc){
  
  if (sc.SetDefaults){
    
    sc.GraphName  = "Test_SubgraphNameShortName";
    sc.AutoLoop   = 0;
    return;
  }
  
  int& executionCount = sc.GetPersistentInt(0);
  
  // add/remove 'ShortName' based on execution number
  
  if (executionCount == 0){
    
    sc.Subgraph[0].Name = "Name";
    sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;
    sc.Subgraph[0].PrimaryColor = RGB(200,200,0);
    sc.Subgraph[0][sc.ArraySize-1] = sc.HLAvg[sc.ArraySize-1];
  }
  else if (executionCount == 10){
    
    sc.Subgraph[0].ShortName = "ShortName";
  }
  else if (executionCount == 20){
    
    sc.Subgraph[0].ShortName = "";
  }
  else if (executionCount > 30){
  
    return;
  }
  
  // increment execution count
  executionCount++;

  // write to log
  SCString debugMessage;
  debugMessage.Format("Name is: %s | ShortName is: %s"
             , sc.Subgraph[0].Name.GetChars()
             , sc.Subgraph[0].ShortName.GetChars());
  sc.AddMessageToLog(debugMessage, 0);
  
}

// OUTPUT:
// Name is: Name | ShortName is:
// Name is: Name | ShortName is: ShortName
// Name is: ShortName | ShortName is: ShortName
// Name is: ShortName | ShortName is:
// Name is: Name | ShortName is:

[2023-12-06 03:32:30]
User462086 - Posts: 196
response: ACSIL returns wrong information | Post: 365292
Date Time Of Last Edit: 2023-12-06 10:46:38

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account