Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 15:50:53 +0000



Post From: ACSIL sc.StorageBlock (how to use this function)

[2023-08-06 09:29:08]
User92573 - Posts: 530
Dear Support Board

I have a study where 2 values are updated via ACS Buttons. I want to retain the 2 updated study values from every chart in my chartbook that has this study loaded - so when they are reopened the last values/settings can be used.

Int Parameter_1 = 5;
Parameter_2 = 6;

I’ve read through the threads and manual and sc.StorageBlock which seems to be the solution, however I can’t find any examples of where to place the different items of code.


// ------------------------------------------------------
// Is this correct?
// ------------------------------------------------------


// Part 1 - Is this placed in the default block?

// This is the structure of our data that is to be stored in the storage block.

struct s_PermData
{
int i_Parammeter1_Stored;
int i_Parammeter2_Stored;
};


// Part 2 - Then in the do processing section where the changes are made

// Using the sc.StorageBlock
// After updating the values:

Parameter_1 = 11;
Parameter_2 = 12;

// Here we make a pointer to the storage block as if it was a pointer to our structure
// Where is this placed?

s_PermData* PermData;

PermData = (s_PermData*)sc.StorageBlock;


// Here we set data using the members of our structure. This uses the memory of the storage block

PermData-> i_Parammeter1_Stored = Parameter_1;
PermData-> i_Parammeter2_Stored = Parameter_2;



2 additional questions re the above:

-   When a chart or chartbook is deleted is the Storage Block automatically deleted or released?
-  I have 10 charts in a Chartbook and 3 Chartbooks in my chartbook group. Each chart has this study. Will each chart save to its own Storage Block?


Apologies for a long-winded thread but Storage blocks are a little beyond my ACSIL knowledge.

Any help appreciated

Many thanks.