Skip to content

add precision to handle floating or double number using getString function in scripts - #3999

Open
agaget wants to merge 1 commit into
ControlSystemStudio:masterfrom
agaget:precision
Open

agaget wants to merge 1 commit into
ControlSystemStudio:masterfrom
agaget:precision

Conversation

@agaget

@agaget agaget commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

In ValueUtil the precision is set to 0, that prevents floating or double number to display the number after the decimal point

So if for example we use the script provided in the example of phoebus for table

# Embedded python script
from org.csstudio.display.builder.runtime.script import PVUtil

# Create matrix (2D array) of strings
data = []

for pv in pvs:
    row =  [ pv.getName(), PVUtil.getString(pv) ]
    data.append(row)

widget.setValue(data)
image

After correction it is displayed correctly.
prec to 2
image
prec to 1
image

The advantage of using getString instead of getDouble is that it is displaying also the egu field

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant