Its my first time making application for Portugais and they us like "Á" and "Ó". My Window name have sometime this and when I use script function system.nav.swap() its look like I got an error:
File "event:propertyChange", line 9, in
ValueError: Window 611 - TRITURADOR PRIM�?RIO (PRIMARY CRUSHER)/OVERVIEW does not exist.
When I try to print str("611 - TRITURADOR PRIMÁRIO (PRIMARY CRUSHER)/OVERVIEW") this I need to put .replace("Ã","Á") for let me know the true value. But If I use this replace I still have the error but it print the path and is good.
It work when its hard type like that but if am reading a value into a column of dataset or something like a tags how did i put my "u" to make it unicode?
It depends. Are you creating the dataset yourself, or is Ignition creating it for you?
Ignition created datasets will be backed by the Java String type, which is strictly superior to Jython's str/unicode separation and should automatically return a unicode type for you.
If you're building the datasets yourself, you can use the builtin unicode() function to convert an arbitrary object to it's unicode representation, instead of str().
Am actually making a dataset of tag with foul tagpath inside of it and some associated window that are in a tag name "SCADA_PAGE" and after am using a power table to open the window path assiated to it and flag it in my page. This is the code I use in the gateway to build my dataset of all my tag that have "SCADA_PAGE" associated.
Header = ['WindowPath','Path','Tagpath']
List = []
Results = system.tag.browse(path = '[default]', filter = {"recursive":True, "tagId":"UdtInstance", "tagType":"AtomicTag", "name":"*SCADA_PAGE*"})
for Result in Results.getResults():
if "_types_" in str(Result['fullPath']):
pass
else:
#print str(result['fullPath'])
WindowPath = str(Result['value'].value)
Tagpath = str(Result['fullPath']).replace("/HMIMEMORY/SCADA_PAGE","")
Path = str(Result['fullPath']).replace("/HMIMEMORY/SCADA_PAGE","").replace("[default]","")
print WindowPath
print Tagpath
if WindowPath == "":
WindowPath = "Not use in any screen"
row = List.append([WindowPath,Path,Tagpath])
system.tag.writeBlocking(["[default]MISC/InstanceNavigation"], [system.dataset.toDataSet(Header,List)])