EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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  <20252026  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  <20252026 
<== Date ==> <== Thread ==>

Subject: Re: Python script to set start & end time of data browser
From: "Kasemir, Kay via Tech-talk" <[email protected]>
To: Vishnu Patel <[email protected]>, "[email protected]" <[email protected]>
Date: Thu, 9 Oct 2025 16:30:35 +0000
The Data Browser widget and thus “trend” in your script have no “start_time” property.
You need to see what “trend” is via
      print(trend.__class__.__name__)
and then study the source code for the API.
The API is specifically not guaranteed, you might have to rewrite your scripts for future versions.
Here’s an example that might help you in the current version of CS-Studio:

# Script triggered by a "minutes" or "start" PV

#

# pvs[0]: Either 'loc://minutes(10.0)' or 'loc://start("2025-10-09 11:00”)'

# depending on option chosen below


from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil

from org.phoebus.util.time import TimeRelativeInterval, TimestampFormats

from java.time import Duration, Instant


# DataBrowserWidget

db = ScriptUtil.findWidgetByName(widget, "Data Browser")


# org.csstudio.trends.databrowser3.model.Model

model = db.getDataBrowserModel()


# Option 1 for PV with number of minutes

# Create relative time range ending 'now'

#minutes = PVUtil.getDouble(pvs[0])

#millis = int(minutes*60*1000)

#range = TimeRelativeInterval.startsAt(Duration.ofMillis(millis))


# Option 2 for PV with start date, also ending ’now'

start = TimestampFormats.parse(PVUtil.getString(pvs[0]))

end = Instant.now()

range = TimeRelativeInterval.of(start, end)


# Option 3 for two PVs with start and end date

#start = TimestampFormats.parse(PVUtil.getString(pvs[0]))

#end = TimestampFormats.parse(PVUtil.getString(pvs[1]))

#range = TimeRelativeInterval.of(start, end)

print(range)

model.setTimerange(range)




---

I am trying to set start and end time of my trends in data browser with the python script 

from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil

trend = ScriptUtil.findWidgetByName(widget, "trend")
start_time_text=PVUtil.getString(pvs[0])
end_time_text=PVUtil.getString(pvs[1])

# Set the start/end time properties of the Data Browser
trend.setPropertyValue("start_time", start_time_text)
trend.setPropertyValue("end_time", end_time_text)

Here I am setting start and end time of data browser by pressing the button.

But I am getting an error,

"java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Widget 'trend' (databrowser) has no 'start_time' property
"

References:
Python script to set start & end time of data browser Vishnu Patel via Tech-talk

Navigate by Date:
Prev: Re: Fast stream-device IOC suddenly disconnects Zimoch, Dirk via Tech-talk
Next: Finding out what's commanding motor move? J. Lewis Muir 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  <20252026 
Navigate by Thread:
Prev: Python script to set start & end time of data browser Vishnu Patel via Tech-talk
Next: Intermittent memory issues - codec.cpp:1135: std::bad_alloc Peiyun Shi 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  <20252026 
ANJ, 19 Mar 2026 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·