09-26-2014 11:32 AM
Having some trouble getting a locked (password protected, not viewable) sequence file to execute (TS2012):
Saved sequence file as password protected / locked / not viewable.
it appears properly as not viewable in the sequence editor and any UIs.
I can start an execution through my custom process model, but partway through the execution the process model references "
RunState.ProcessModelClient.Data.FileGlobalDefaults.***", and I get an error specifying that
"The lookup string RunState.ProcessModelClient.Data.FileGlobalDefaults.*** references a protected object that is locked."
http://zone.ni.com/reference/en-XX/help/370052M-01/tsref/infotopics/db_seq_file_prop_adv_tab/ suggests that the API is not supposed to be limited to access during execution.
Any recomendations as to how to allow the process model access to Client Sequence File information during execution when the client sequence file is locked as not viewable?
Solved! Go to Solution.
09-29-2014 10:57 AM
What exactly is the code doing that gives you this error? What API call is giving the error?
-Doug
09-29-2014 11:15 AM
Code is a statement step in the process model
(Post)Expression for statement is
Locals.FileGlobals.VariableName=#NoValidation(RunState.ProcessModelClient.Data.FileGlobalDefaults.VariableName)
(replace "VariableName" with actual name of variable) "VariableName" is instance of a type-def'd container (contains 2 booleans and a typedef'd container that itself contains 3 booleans)
(Yes we do have a locals.* container named "FileGlobals").
The goal here is we have some configuration settings stored as FileGlobals.* in the client sequence file (I realize there are some other ways we could do this, but we're kinda stuck with this architecture for now) and we are copying those values to locations in the process model so we don't need to keep referencing the client sequence FileGlobals.
09-30-2014 12:16 PM
The edit time copy of the file globals are protected (even at runtime), however you can access the runtime copy of the file globals programmatically as follows:
#NoValidation(Locals.FileGlobals.VariableName = *RunState.Execution.GetFileGlobals(RunState.ProcessModelClient).GetPropertyObject("VariableName", 0))
Another option is to use the parameters of a sequence instead. Those are unprotected by default, even at edit time. For example:
#NoValidation(Locals.FileGlobals.VariableName = RunState.ProcessModelClient.Data.Seq["MainSequence"].Parameters.VariableName)
Hope this helps. Let me know if you have any questions related to this.
-Doug
10-01-2014 10:23 PM
Doug --
Thanks -- your suggestion worked just right.
Things are working well now.
Warren