Problem with read data from DataSet

Hello, I have a problem with reading data from the dataset. You can look at to image with error and my code and say me what I do wrong?
Thank you

	if 'A' in self.getSibling("Label_1").props.text :
			self.getSibling("Label_2").props.text =   self.view.params.viewAdapt.getValueAt(0,"Umístění")

And data in dataset

Thank you

You have accents on “Umístění” in your code, but there are no accents on the column name in the dataset. Since other columns do have names with accents, I don’t think it is a failure in Ignition.

Yes, but how I can solve this problem. Can I read the data differently?

I believe .getValueAt() also accepts the number of the column, so you can do self.view.params.viewAdapt.getValueAt(0,8)

If you have some hidden columns it will be a different number from 8 thought.

That’s depends on how you read it now. You haven’t told us what mechanism in Ignition created the dataset. If a simple DB query, then your DB is probably responsible.

Hello my DataSet are from SQL query.

SELECT  adapter.barcode AS [Čárový_kód_adapter],
	adapter.name AS Název,
	adapter.forMachine AS [Pro_stroje],
	adapter.numberSqueeze AS Otisků,
	adapter.avergeFrom AS [Průměr_OD],
	adapter.averageTo AS [Průměr_DO],  
	adapter.[rt] AS [3RT],  
	adapter.coldCanal AS [Studený_kanál], 
	adapter.location AS Umístění , 
	adapter.ID_adapt  AS  [Adapter ID] ,
	reject.barcode_reject   AS [Čárový_kód_vybijeni],
	loadGrip.barcode_loadgrip  AS [Čárový_kód_nabijení] , 
	machine.barcode_machine   AS [Čárový_kód_stroj]   ,
 	loadGrip.location_loadgrip   AS [Umístění nabíjení],
 	reject.location_reject   AS [Umístění vybijení]  ,  
	machine.name  AS Stroj,  
	reject2.barcode_reject AS[Čarový kod vybijeni], 
	reject2.location_reject AS [Umísteni], 
 	reject2.numberSqueeze AS [Počet otisků]   
FROM  adapter 

LEFT JOIN  loadGrip 
ON [adapter]. ID_adapt =  loadGrip.loadID 
LEFT JOIN    machine 
ON [adapter]. ID_adapt =   machine.machinejID 
LEFT JOIN   reject  
ON [adapter]. ID_adapt =   reject.rejectID 

LEFT JOIN   reject2  
ON [adapter]. ID_adapt =   reject2.rejectID 
WHERE   adapter.barcode  = :barcod 

Thank you

If i use viewAdapt.getValuAt(0,8) I get error :

This is in the dataset.

This is in your jython. Different accents.

Make sure any string references in your Jython code use the unicode string marker as well.

This:

Should be:

self.view.params.viewAdapt.getValueAt(0, u"Umístění")

(and also have all the correct accent marks if necessary, I’m not really following along)

1 Like