Typecasting Issue with Script Transform on Custom View Property

I have a Perspective view with a custom property, type dataset.
I bound this to a dataset tag and added a script transform to pick out the rows I need.
The view populates correctly in the Designer, but not in a running session.

( I found a similar post here but it says this issue was resolved.
[Bug-1083]Perspective script not fully executing in client but does in Designer - #7 by nminchin )

The image shows my browser console output for my datatype in my script transform.
It seems that the parameter enters the code as an INT, but eventually turns into a DATASET.
Unfortunately, the INT is used when proceeding through the script and causes an exception.


are you using the version that it was fixed in?
could you share some code?

I am using Ignition 8.1.9.
I am seeing this error: “AttributeError: ‘int’ object has no attribute ‘getColumnCount’”

This is the only line where I print a Perspective message:

system.perspective.print('TESTING --- type: %s' %str(type(dataRaw)))
iColumnCount = dataRaw.getColumnCount()

Yeah im not much with two lines… Could you show every line that uses dataRaw xD

Could you please share the code preceding the print statement you’ve provided?

I pass in a dataset-tag from an expression (which becomes “value”).
I simplified my code to what’s shown below and I still get a type INT before a Dataset.
I also removed all other bindings and scripts from the View.

Another question, do you know why this would be executing multiple times?

dataRaw = value
system.perspective.print('TESTING --- type: %s' %str(type(dataRaw)))
iColumnCount = dataRaw.getColumnCount()

The binding and transform will execute when the binding “starts up” (when the View/component mounts) and then again whenever the tag changes.

Is there any chance you could export the View and supply the json file here?

Well, I was able to simplify the view for export and put in some extra print statements.
As a result, it looks like I can get a column count eventually if I check the datatype before executing.


But I have not attached anything, because I may have solved the problem by being more thorough.
Thanks for your help guys.

Putting in extra handling is just going to mask the fact that you’re getting an unexpected value. It’s been my experience than until you understand how/why that value is entering your script that you are going to encounter this again somewhere else.

Yea just catching this isnt really a good idea.
I think its either your dataset or your tag that is failing on load for some reason…

You will have to starts showing some more than just console prints tho if you want more help xd
show us the dataset tag, how it gets it values and the expression you used

I think I have narrowed down the problem. It seems that the View Params and View Custom properties load in an unexpected order. Here is my process to load data into my page:

  • I navigate to the page url with a parameter passed in (i.e. parameter passed in as “/page/:StationID”)
  • This parameter is used in an expression binding to determine which tagname to read in a Custom property (i.e. property of “StationName” is bound to “StationID”)

In the session, my table gets an overlay with a BAD tagpath:
‘[TP]Folder…/ERROR/…’ not found.

The “ERROR” string value comes from the failed expression which is “case(1, ‘name1’, … , ‘ERROR’)”

Any thoughts?

That expression binding is always going to fault because URL params will ALWAYS be string values, and you’re only supplying one unchanging value of 1. Try something like this instead:

case({self.view.params.StationID}, "1", "name1", … , "ERROR")

Although if you follow a naming pattern, you could always just do

"name" + {self.view.params.StationID}

That fixed it thanks!