Perspective Views (Open in multi pcs, individual sessions, same structure)

I would like to know if it is possible to open the view (perspective/client) as unique.
For example, I created a View (Perspective / Views) but I would like to open in different pcs using the same structure but independent results/values (this project makes some consults in the database), like when we open Excel in different instances.

If is it possible, could you share some examples or how to do it?

Thanks

This should be no problem. What have you tried? What worked and what didn’t?

For keeping results unique to each instance utilize custom session props. Have something either top level or one of the views that then polls your database accordingly and places the data there. Then you can bind a table or other data display to that custom session prop.

You can also have custom props at the view level, but I don’t believe these will persist if you switch pages during navigation

If you are allowed to, can you explain a bit more of what exactly you are aiming to create?

1 Like

I’ve already developed the interface and it works on my browser PC1, but if I open the same View (project) on another PC2, what I change on mine (PC1/browser) reflects on the other PC2 and vice versa.

How are you changing what you view on PC1? If it’s by changing a tag, that will change it everywhere. You could use session properties as @ryan.white suggests to make the results unique per session. Or, depending on what the end goal is, you could just use components on the view that aren’t bound to anything to control the query as long as the query result is bound to the table or a session property, not to a tag that would affect all users.

1 Like

The main idea is:
the user will enter a serial number and the system will display the information (the system will query the database and return the data) to the user.

But I would like to have the same “system” for different users so that they can use it at the same time and each have their own information on the screen.

What you’re looking for (unique results per session) is default behavior if your query takes user entered serial number from a component and returns results directly to table (or a session property).

It sounds like either your serial number or query result are bound to a tag. This is what you would do if you wanted all sessions to get the same result as tags are global/shared.

2 Likes

Awesome, thanks guys @witman and @ryan.white helped me a lot.
I was using tag to execute the query against the database. Now I need to figure out how to execute the query without sending information through the tags, and get the results.

Request data from a database using a Named Query on a binding, or with a script you can use either system.db.runNamedQuery() or system.db.runPrepQuery()

Strongly recommend the use of a Named Query.

https://docs.inductiveautomation.com/display/DOC81/Named+Query+Bindings

1 Like

@lrose Thanks for the help, I’m starting to use NamedQuery.
How can I get the result into a label for example?

I run the query and result in 1 row with 4 columns and I need each column to go a different label like:
label1: result QueryX column1
label2: result QueryX column2
label3: result QueryX column3
label4: result QueryX column4

There are a few ways to do it.

How is the NamedQuery called?

1 Like

I would like to call by the script and the result populates the labels.
I’m trying using it on a binding, but I have a lot of labels, and I don’t think this is the best way.

Is the purpose of the Named Query to populate the labels? After the user enters the serial number to they click a button or make some other action which will trigger the query?

1 Like

@lrose I think I got it. Thanks for your help.
This is an example of how I did.

namedQuery = “getData”
parameters = {“vSerialNumber”:vText}

data = system.db.runNamedQuery(getData, parameters)

lb1 = data.getValueAt(0, “data1”)
lb2 = data.getValueAt(0, “data2”)
lb3 = data.getValueAt(0, “data3”)

self.parent.getChild(“FlexContainer”).getChild(“cont1”).getChild(“label1”).props.text = lb1
self.parent.getChild(“FlexContainer”).getChild(“cont1”).getChild(“label2”).props.text = lb2
self.parent.getChild(“FlexContainer”).getChild(“cont1”).getChild(“label3”).props.text = lb3

Thanks all again.

1 Like