Show tester stations for particular serial number in flex repeater from memory tag

When I search for a particular serial number, how can I make it to display it's tester stations in a flex repeater for that serial number from a memory tag.
I don't know how to bind the search option for a particular serial number after typing it in a text field and displaying only that serial number's EOL and IN line tester stations in a flex repeater....
I've created a memory tag there with the serial number and tester stations and I don't know what to do next?
image
image
C18L08684 is the serial number I've created as folder and its tester stations in memory tags when I bind it to text/search button it shows error.
Anybody help me...

The least performant way is to call system.tag.browse('path/to/device') in the client which will return a list of tags in the device folder. Use [str(tag['fullPath']) for tag in tags] to get a list of tagPaths

The better way would be to use the same method, but instead of calling it from a client, call it in a script library but return all tags for all devices. Collate it all into a dictionary of serialNumber: tagPaths[] pairs, and then in the client, just lookup the serial number in the library dictionary to return a list of the tagPaths

Eg.
In project.library_name

tagPaths = [str(tag['fullPath']) for tag in system.tag.browse('[default]Inline_Station_Status', filter = {'recursive': True, 'tagType': 'AtomicTag'})]

DEVICE_SN_LOOKUP = {} 
for tagPath in tagPaths:
   sn = tagPath.split('/')[-2] 
   DEVICE_SN_LOOKUP.setdefault(sn, []).append(tagPath)

Then in your perspective view, add an expression binding linked to your filter, with a script transform:

project.library_name.DEVICE_SN_LOOKUP[value]

The lookup dict will get updated every time you save the project or restart the gateway

Please excuse me, I really don't understand this...
Can you explain me the following step by step so that I can do it...

Create a script 'folder' in the scripting section of the designer and name it 'prokect' , then under that, create a script 'file' called 'library_name' (or whatever you want to name it)

Copy my code above after "in project.library_name" into the script file.

Hopefully the View part is described in enough detail


Create a script 'folder' in the scripting section of the designer- is this what you mean
in custom methods or message handlers?

No, it's not under Perspective in the project browser. It's under the Scripting section

No, I didn't get you....In which scripting section, is that you are pointing out text field's scripting?

Project Scripts Video at Inductive University

1 Like


Am I correct?
How to create script file here...its showing only package....
how to call it in a script library but return all tags for all devices. Collate it all into a dictionary of serialNumber: tagPaths[] pairs, and then in the client, just lookup the serial number in the library dictionary to return a list of the tagPaths
@pascal.fragnoud

The way this is set up, you don't 'call' it. You just use the lookup table, like Nick showed you.
To make it simple, that 'Project' thing you created is a python file. It will be loaded automatically, and when it's loaded it runs the code inside. Anything that is at the top level (not in a function) will be executed. So here, that piece of code will execute, and you'll have an array called DEVICE_SN_LOOKUP that you can reference in your project, using Project.DEVICE_SN_LOOKUP.

If you want to call that bit of code yourself, you need to put it in a function.

Note 1: Don't call the script Project. That's a terrible name. Try to find a name that conveys what what's inside is used for.

Note 2: I'm not super fond of that script. I don't like the [-2] here, but I'm also not too sure of what you want. Do you want to extract all folder names in the Inline_Station_Status Folder ?

Note 3: I'm also not very fond of the whole design here. I'm not sure how flexible your project is, but I'd make a UDT instead of a folder.

Note 4: Are those SNs constant, or do you add/remove them dynamically ?

I made some assumptions with the code, and it was more a "this is an example of how you can do it" with the little info we were given, as a starting point. Obviously it will need to be modified if the other folders don't have similar structure to the screenshot. (the concept at least is there)

I assumed that each device folder had similar tags and no sub folders, hence [-2] is fine, but definitely limited to use as is.

Agree with you regarding the tag design, I think it could be better. Without knowing the problem being solved though, we can't offer any help

See, the thing I want is when I enter serial number(C18L08684) here
image
It should change its tester status like this


How can i use this SELECT statement and make pass fail status to show

SELECT TESTERNAME, PASSFAILSTATUS
FROM UT_INTELLIPAK.FPYDPUVIEW
WHERE dbid IN (SELECT DISTINCT dbid
FROM UT_INTELLIPAK.uutinfo
WHERE value = 'C18L08684')
MicrosoftTeams-image (5)

Wait, you were using tags, and now it's a database table ?
It's all VERY confusing.

Let's try to make things clear and simple:

  • Is the data in the memory tags the same as in the database ?
  • Which one is the source ? Tags or database ?
1 Like

Speaking of XY...

1 Like

Actually data in db and tag is not same as I created memory tag on my own and I want it from those memory tags..
source is from database but I want it from memory tags which I created...

Why? Just get it from the DB.

Create a custom property to hold the data from the table, then use a lookup expression to get the status for the serial number.

No, as my PC couldn't access db and OPC tag will not work in it..
So I wanted it from memory tag

Is the gateway running on your PC?

Gateway running in trail mode

This doesn't answer the question, and also doesn't really matter as you can still configure a connection to the DB.

If the Gateway is running on your PC, then okay it doesn't have access to the DB. If the gateway doesn't have access to the DB, then there is no way to pull the data from the DB into Ignition, memory tag or otherwise.

So which is it, Ignition has access to the DB or it doesn't?