WinCC Unified: how to create a dynamic output format

Опубликовано: 02 Апрель 2026
на канале: DerHecht4.0
11,538
56

miSta1982 struggle with a dynamic output format and ask me how to realize it. In this Video I want to show you a possible solution display a value depending on the decimal places

//JavaScript Example

let Unit = Tags("DB_Analog_Temp1.Unit").Read();
let str = value.toString();

if (str.includes(".")){//check if float
str = str.substring(str.indexOf(".") +1);//create substring after the "dot" and add +1 to the index to remove the dot from the string
item.OutputFormat = "{F"+str.length+"} "+ Unit;//read the length rom the substring
}
else {
item.OutputFormat = "{I}" + Unit;//{F0} = 1.0 and not 1 that why {I}


00:00 Intro
00:25 solution
01:09 how does the script work

JavaScript String substr()
https://www.w3schools.com/jsref/jsref...

JavaScript String indexOf()
https://www.w3schools.com/jsref/jsref...

#DerHecht #WinCC #Unified #TIAPortal