I don't understand Component method.
Perspective Component Methods - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)
I referred to this document but couldn't find an answer.
I want to create a script to get the C label text into the B label text.
but I haven't been able to solve this problem.
I would like to know the answer to this question. And I would appreciate it if you could teach me how to use parent and getChild in a more understandable way.
thanks for reading!
They're not in the same view, this just won't work.
To access things that are in different views, you'll need to use messages. If the view is even loaded, like in a dock... otherwise, its message handler won't exist and you won't be able to catch the message either.
I'll see if I can make a quick example, in the meantime can you explain the use case ? I feel like you're trying to do something that does not need to be done.
In my actual project, I'm trying to save all the container's information to the DB using a button.
The screen is structured like this.
Yea alright. That's probably not the way to go.
In the button's scope, your data doesn't exist. Even if you embed it in your main view.
There are different ways of achieving what you're trying to do. This is all assuming the data fields are not embedded view themselves. I can see that they are, so you'd need to pass the data back to the view through view parameters, to make it accessible to the main view.
But frankly this all becomes way too complicated for what needs to be done.
- Pass the data to the view that contains the button, then use this data from the button
- Use a click event on the embedded view, not on the button. The embedded view will have direct access to your data.
- Go through a 'global' data source: tags, database, session props...
- Put your button directly on the view.
Frankly, use the last solution. There's no need here to make a view for a single component.
The same goes for your drop downs and text fields. Don't put them in separate views, use containers instead. This will make EVERYTHING much simpler:
- You won't need to have a extra views containing just a component and a label
- The data will be much more easily accessible
If the goal of 'templating' everything was to have one single source for your components appearance, use styles instead.
The only time I'd make a view just for embedding, is for template repeaters (And I really wish I could repeat basic components) and things that are complex and that I want to reuse in other places, but without having to make it in java.
In all honesty, I'd remove all the embedded views and put containers instead, containing the labels and drop downs.
edit: One last thing: When trying to select/target something from a script, use the property browser. This will list what's accessible, and insert the path directly for you, so you don't need to figure out if you should be using
You mean using multiple containers in one view?
Yes. You can nest containers as well, especially flex containers, to build your layout.
Make a column container.
In this container, add a row container that will host the 'hardware', 'identity' and 'placement' cards.
For each of those, add a column container, and then a row container for each row of your form.
Or, use coordinate containers and calculate their positions to make everything fit nicely and responsive.
I know a lot of people here use coordinate containers, as they allow a higher level of customization, and don't require as much nesting, but frankly... In most cases I just flex, it's usually quicker.