Programmatically create sequence?

Is it possible to declare a new empty sequence during runtime? I’m not seeing it in appslib or seqlib, and declaring any new variables (e.g. sequence NewSequence;) in hsl blocks is telling me there are undeclared identifiers.

try the “SeqRemoveAll” from “C:\Program Files (x86)\HAMILTON\Library\HSLSeqLib.hsl”

1 Like

That’ll work. Thanks!

That said I’m still curious to know if it’s possible to declare a new variable in an hsl block if anyone knows what I am missing.

Variables declared in an inline HSL step (used in method editor) cannot supersede the scope within the block they are are declared in. They are local to the scope of the in-line HSL.

If you can elaborate a bit on your intention and use case I may be able to provide better guidance.

Thanks.

-Nick

It’s largely a quality of life thing - for concatenating strings or longer bits of arithmetic I frequently will use in-line HSL blocks, but almost as frequently I forget to create the variables to hold the final value until venus kicks back after I’ve written the hsl. Or if I need to make a bunch of variables, it would be very nice to be able to do that with copy paste rather than repeatedly making them one at a time in the variables pane.

1 Like

My suggestion would be in future instances where you forget to instantiate a variable used in in-line HSL, which needs to be visible outside of the local namespace of the in-line HSL, then to just temporarily accept the syntax error.

image

Select the ‘Cancel’ button on the error window for the in-line HSL, and the line of method editor (with all of the HSL code contained within) will be retained - just flagged for syntax error.

At that point you can simply add the variable/object in the ‘Variables and Constants’ toolbox to the relevant scope level, and assign a start value if desired. This will add the variable ID to the local namespace level and clear the error and move on.

Additionally, regarding your initial question about adding a new sequence object to your local scope or namespace, you can do the same technique as the above by instantiating it via the ‘Variables and Constants’ toolbox

image

Thanks.

-Nick

1 Like