Perspective dataset tag read and filter

Hi to All,

I have a memory tag type dataSet. I would like to filter data from that tag is it possible?
dateSet is huge [3658x19] conditions for filtering are changing and I can have as 10 conditions that one record has to satisfy in order to be filtered. Is it some way to do that?

Thanks!

Possibly, but an example might help. Are you trying to do all of this based on user-selected values, or where are the conditions coming from? Is there a reason this data isn’t just in a database?

Ok. I want to show an overview of huge storage, which location is occupied with a product which is empty. As 4000 objects are too much for one view (can’t work) I am using the Ignition table to show it. Each cell in the table is a location in the storage. Close to this table I am showing devices as moving and how they picking up or lowering data in storage. And observer of the screen expects that location in the table, that represents storage also changes. Data about storage are in SQL table, but it’s a huge amount of data and data are not changing fast at all. I don’t want to read all that data in every 1, 2 s, but I want to change, update location in table when device lowering product within 3s. What I am doing, on start-up of the Ignition I am reading that huge amount of data after data I am changing in data set only data that are changed (tracking devices and actions). As each location and product have some set of the property I made a function for filtering data in the storage according to selecting properties (filtering: only locations cells that satisfy condition will be with color). I can do filtering by SQL Query, but as I want to show reliable data I will need to send the query on every 3 s, but why do that when I already have dataSet in the ignition that is updating on the event of the change. I want to filter mu local dataSet.
Main challenge (problem) is because I have SQL data for something that is not proper to be from SQL (for this data I need events) and because I am showing it in table, but is not proper for table :slight_smile:

Thank you very much for help!

Sounds like you want my view() expression function from my Simulation Aids module. Takes a dataset you already have and applies “Pseudo-SQL” to it to yield a new dataset in a binding.

Thank you very much!
Yes, looks like it is what I need, I have to test it.

Thanks!

Phil,
I installed your module, restarted designer, but still I am receiving error message, “global name ‘view’ is not defined”.
Do I need to restart gateway?
Thanks!

That sounds like a jython error. The view() function is an expression function–for use in bindings.

Thank you very much!

I managed to use it as function and works great!

1 Like

Phil,

How can I filter data according to the columns with the date-time type of data with view () expression function?
My expression is something like
view( “Select * WHERE Assigned_Time > 9/25/20 00:00:00 AM” ,xxx) …

Thanks!

The WHERE clause must be a valid python expression, using the columns from the dataset (munged if necessary). So the constant datetime for comparison must be a datatype compatible with the column content you are comparing against. There’s no way in python to make datetime constants, so the best way to do this is to pass the constant in from the argument list. Something like this:

view("Select * Where Assigned_Time > args[0]", xxx, getDate(2020, 8, 25))

(Watch out for the odd month numbering for the getDate() function.)

Phil,

Thank you very much!
That is the solution I was looking for.