Perspective Memory String Array Write

Thank you so much for all the help! I don't know why I didn't think about needing to be more descriptive for the next person in order for the read through. I will take this all in and use it!

This is all to look through a drop down and get the selected supervisors name and email in order to then write it to a tag so that I can have an alert go off and make an expression rooster in order for a pipeline to send an email to a unique roster.

That's the how, not the why/what.

Is the goal to have a specific user-configurable roster for a specific alarm ?

yep

I kinda feel like this should be in a database table instead...

Also, for people newer to Python ChatGPT can help you re-write nested for/if statements in a more Pythonic way using list comprehension.

It's totally readable, but coming up with things like the list comprehension you see in my script below on my own when I first started with Python would've been very difficult.

def getSensorList():
	# get all tags in the analog folder
	tags2 = system.tag.browse("[default]Analog_Sensors", {'typeId':'Scaled_Analog_2SP', 'tagType':'udtInstance'}).results
	tags4 = system.tag.browse("[default]Analog_Sensors", {'typeId':'Scaled_Analog_4SP', 'tagType':'udtInstance'}).results
	
	tags = tags2 + tags4
	
	# extract tag names and descriptions
	names = [str(t['name']) for t in tags]
	tag_paths = [str(t['fullPath']) + "/Parameters.Name_SA2SP" for t in tags]
	desc = [str(d.value) for d in system.tag.readBlocking(tag_paths)]
	
	# create dataset
	headers = ["Description", "Tag Name"]
	data = [[desc,name] for desc, name in zip(desc, names)]
	dataset = system.dataset.toDataSet(headers, data)
	
	#print headers
	#print data
	
	return dataset

It might not get it right the first time. You can try feeding errors back into it, but I've not had much luck with that. ChatGPT is really only useful for simplifying small pieces of code.

Honestly that was my first thought when creating this but thought this would work and just started going with it

Thank you! I have been using it a bit when I have gotten stuck and couldn't figure out something. Definitely will give try for condensing code.

I feel like I'm the only one who hasn't tried chat GPT yet.

And the worst/best part is I registered for the GPT-3 beta years ago and received a key/whatever is was... and never used it.

You aren't the only one. I refuse to use it, because you can't tell when it makes [expletive] up unless you already knew the answer to begin with.

{ And I refuse to participate if someone brings AI output to me and asks me to help "fix" it. }

2 Likes

I feel like a lot of times it is great to get a baseline if you are lost to where you should even start. Or check your code and find the little mistakes that you made syntax so you aren't just staring at your screen for hours.

Staring at your screen for hours is how you learn how not to make those mistakes anymore, though ;p

so true though, the mistakes that spent me hours to find I'll like never do again since constantly thinking about

Using a modern language and a modern dev environment is another way.