How do I make a list of "things" I can "thing.doStuff()" with? (idk correct terms, apologies)

I'm working on a data acquisition and graphing app for my greenhouse.
In order to not rewrite virtually identical code a huge bunch of times or getting into a zillion nested if...thens while processing the data I'm gathering and generating the graphs, I need to do a thing idk what to call, but an example is pretty easy: (apologies for bad pseudo code)
</code
var PPM_DB = TinyDB1;
var PH_DB = TinyDB2;
var Temp_DB = TinyDB3;
var Amount_DB = TinyDB4;
var list = [PPM_DB, PH_DB,_Temp_DB,Amount_DB];

function Example(int val);
var Current_List = list[val];
Current_List.StoreValue("tag", 123);
end

/>

Is there a way to do this? Not only with TinyDB, but with most other "programming blocks?"

yes possible.
This is called any component.
Save the components in List, then get item from the list, then use any component to set its property or do some function.

Any component block is in left panel of block view.

I actually accidentally discovered you can make any block "generic" about 3hrs about posting when I dropped my mouse and went from there but I'm having troubles getting it to actually work with a different component. I'm trying to setup some graphs and doing a foreach loop on a list of GraphData2D's only works on the first graph, nothing else gets data. I'm sure it's just a stupid on my part, it's midnight here and payday so I'm pretty stoned, I'll give it a go in the AM once I've had some coffee and brainfood. Thanks for the help, I mighta figured it out myself but your answer was spot on and succinct, tyvm .

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.