How to access input data

This seems like it should be easy, but I’m struggling trying to figure out how to access data I acquire via an InputPort so it can be used elsewhere in a program. (To be brief and help clarify, here are relevant snippets).

function myFunction()
{
(I’m trying to access value from InputPort here);
}

class myInput extends InputPort
{
function set(value) { }
}

I can successfully capture and utilize the input data within the set() function (as is also shown in several code examples), but just can’t seem to get at the data if I am external to the set() function. Have tried several approaches (I can elaborate if necessary) to no avail. Perhaps I just need some remedial OOP, but would appreciate if anyone might be able to provide any suggestions or guidance.

Thanks,
Larry

You can just store the value in a global. At the top level, do this:

// initialize global variable "setting". Doesn't matter what we set it to, it can change type when assigned. This creates a slot in the root table, which is accessible from anywhere. setting <- 0;
…then just do “setting = value” in your set() function and simply refer to “setting” in myFunction().

Thanks Hugo … I missed this re: how to declare/use globals.

Hmmm … well, I should have tried first prior to responding. Here’s what I tried …

alarm1_status <- 0;

class Status extends InputPort {
function set(payload) {
alarm1_status = payload.alarm1_status;
}
}

Here’s what I get … ERROR: trying to set ‘class’

It seems like I continue to miss something very basic here. Thanks, Larry

Forget that
… not exactly sure where it came from … probably some artifact of the cut/paste.