Reading OPCTag Scale Mode

I am new to Ignition and having a little trouble with a tag builder I am creating.
I am trying to set a checkbox when the scale mode is set to BitInversion however the if statement always returns false regardless of the scale mode.

I am writing the scale mode to the checkbox text and seem to be using correct text value just no checkbox selection.

Can anyone give me some hints?

Thanks
Geoff

	tagPath = self.view.params.fullPath + "/MonitoredValue"
	OpcItemMode = system.tag.getAttribute(tagPath, "ScaleMode")
	self.getChild("root/Invert Value").props.text = OpcItemMode
	if OpcItemMode == "BitInversion":
		self.getChild("root/Invert Value").props.selected = bool(1)

Hi,
I think you are overcomplicating this.
If you want to indicate if the scale mode of a tag is set to bitInversion or not using a checkbox, you can do it like this.

This binding should be added to the selected property of the checkbox.

Hi,

Thanks for the reply. I should have provided more context on what I am trying to do. I am loading the values in the onStartup event of a popup form, the user can then change settings and either click save or cancel. For this reason I do not use bindings as I might not want the changes to apply to the tag.

I have done a bit more testing and found that the system.tag.getAttribute(tagPath, "ScaleMode") returns a value of type com.inductiveautomation.ignition.common.sqltags.model.types.ScaleMode which is why I believe my if statement fails. Any idea how I can test the string type from a class?

Thanks
Geoff

Maybe something like:

toString({value}) = 'BitInversion'

edit: oops, that's more a modification to what @mpoulsen921 suggested.

If you're doing this in scripting just use str() on the ScaleMode enum value you have.

Thanks Kevin,

Using str() has solved my problem.

Geoff