Hey Kay,
Thanks for the response, I guess I am a little stuck then on best way to proceed. I was exploring pyepics before to connect database values into PVs. Essentially we are trying to setup the CSS GUI with experiments (Buttons) that someone could click, that click would then call a script (python probably) that would then populate PVs with values from our databases.
Really what I was hoping with the CSS approach was just an automation of someone entering the values into the fields after they click the button through jdbc calls. I agree GUI shouldn't do anything on their own, this would still be with user input by clicking on the specified experiment.
-----Original Message-----
From: Kasemir, Kay <kasemirk at ornl.gov>
Sent: Thursday, March 25, 2021 5:18 AM
To: Manoussakis, Adamandios <manoussakis1 at llnl.gov>
Cc: tech-talk at aps.anl.gov
Subject: Re: Possible to Populate CSS text fields with JDBC calls?
> I was wondering if it is possible to pull a value from a database using .. JDBC .. on our CSS GUI.
> .. then push them to all the IOC (PVs) when needed.
Well, inside a display builder script you can perform any Jython call.
So in principle you can put this into a script:
from java.sql import DriverManager
connection = DriverManager.getConnection("mysql:....");
statement = connection.createStatement(); result = statement.executeQuery("SELECT a, b, c FROM xyz ...");
But there are several issues with this approach.
If you need to ask how to do this inside a display builder script, then better reconsider because the script API might change. So in 3 years you'll have to re-implement that script inside the display.
More important, displays should just display PVs to the user, and write to PVs when users enter something. Displays should not do anything on their own like connect to a database and then populate PVs from that.
If you need the control system to do something, put that functionality inside an IOC or a similar service.
For connecting to a database, the IOC code in EPICS base might not be the most convenient approach but you can access PVs from python. So use a plain python script that runs as a Linux service, connects to the database and PVs, and periodically queries the former to update the latter.
That way, the functionality is in plain python code that doesn't depend on some specific GUI tool.
It's always online, no matter if somebody opened the GUI or not.
Also consider what happens when a user closes the GUI, so you would then lose that functionality.
Or consider that more than one person opens the GUI, so you would then have that embedded script run more than once, and each would try to control the PVs.
From: Manoussakis, Adamandios <manoussakis1 at llnl.gov>
Sent: Wednesday, March 24, 2021 8:49 PM
To: Kasemir, Kay <kasemirk at ornl.gov>
Cc: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: [EXTERNAL] Possible to Populate CSS text fields with JDBC calls?
Hey Kay,
I was wondering if it is possible to pull a value from a database using CSS's JDBC implementation into say a text field on our CSS GUI. I have been trying to figure out best way to store different configurations (Multiple experiment configurations) in a database then push them to all the IOC (PVs) when needed. I was hoping there was an easy solution to doing this, but maybe I need to write a python script to grab and write to the CSS GUI text fields using jdbc?
DB -> CSS (using jdbc calls?) -> fill in CSS GUI fields -> which would write to the PVs
Thanks,
Adam
- Replies:
- Re: Possible to Populate CSS text fields with JDBC calls? Ralph Lange via Tech-talk
- References:
- Possible to Populate CSS text fields with JDBC calls? Manoussakis, Adamandios via Tech-talk
- Re: Possible to Populate CSS text fields with JDBC calls? Kasemir, Kay via Tech-talk
- Navigate by Date:
- Prev:
Re: Possible to Populate CSS text fields with JDBC calls? Kasemir, Kay via Tech-talk
- Next:
Re: Possible to Populate CSS text fields with JDBC calls? Ralph Lange via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Possible to Populate CSS text fields with JDBC calls? Kasemir, Kay via Tech-talk
- Next:
Re: Possible to Populate CSS text fields with JDBC calls? Ralph Lange via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
|