WinCC Unified: how to create a dynamic output format
ฝัง
- เผยแพร่เมื่อ 7 ก.พ. 2025
- 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()
www.w3schools....
JavaScript String indexOf()
www.w3schools....
#DerHecht #WinCC #Unified #TIAPortal
Thanks a lot. My solution was to replace the switch case statement with 4 simple if statements.
Hi..i need a solution. i want to enter a value from hmi and it should be compared with Min value and max value if entered value is bw min and max value then plc tag value will be changed other wise not..i dont want to add min max in HMI tags..i want to do this with script.can you help me..?
hello, how can I divide the output value in the output format by 1000? is there any way?
hi, how can I add an offset to a reading value?
Hi Hecht, I am not able to do this in unified, Could you please help me ?
My Object = I/O Field
Address Format = Dint
Type Mode = Input/output
Display Format = Decimal
Decimal Places = 2
Format pattern = 99999
Hi,
what do you want to do? Should the user only be able to enter a maximum of 2 digits, so the largest number would be 99?
Thanks a lot!!!!
Hi, Thanks for all thoses videos that help probbably also siemens :-)
I'm facing a small issue : I want to extract numbers from a string and convert them into INTEGER..
Exctract works without any issue, but, the " int result = integer.parseint(db) " (db is my extracted string) is not recognized. Any idea ?
Thanks for all
Frantz
let youtInt = parseInt(db);
Moin,
ich versuche gerade in WinCC Unifed V16 ein EA-Feld mit einen INT Wert mit 2 Nachkommastellen anzuzeigen und als Eingabe machen.
Ich hab als INT-Wert 5 und anzeigen solls als 0,05. Wenn ich am HMI über die Tastatur 0,19 eingebe soll der INT-Wert 19 haben.
Anzeige funktioniert soweit, bloß die Eingabe will nicht so wirklich.
Ich hab bei "Änderung" ein Skript:
var value;
value = value * 100; //auf INT-Wert multiplizieren
Tags("$Variable").Write(value);
return value;
Leider finde ich keine Syntaxübersicht in der beschrieben wird, welche Funktionen das EA-Feld hat in JavaScript...
Kannst du mir da weiterhelfen?
Moin,
eine Syntaxübersicht habe ich auch nicht. Was hast du beim Ausgabeformat am EA Feld eingestellt?
Hast du hier schon mal Eigenschaft auf {F2} gesetzt?
@@DerHecht40 Ich habs auf {F2} gestellt. Mittlerweile habe ich die INT-Werte auf REAL umgestellt und hab damit jetzt keine Probleme mehr. Bei altem WinCC konnte man das wunderbar machen... Mal hoffen, dass Siemens da noch nacharbeitet.
what if i got a real value and i only want 1 decimal?
If you want it everytime 1 decimal you can use {F1}
@@DerHecht40 thanks found it and made a script so it changes depending on a tag 😊
How to change "Process Value" with "script", not "tag"
Hi Marek,
this is not direct possible. You can change the processvalue by using indirect addressing, Or you need to put your IO field in a faceplate an change the faceplate interface dynamic