[Question-Resolved] Perspective Components (Template)

Not quite sure I understand what you mean. My brain is pretty exhausted atm :grin:

My goal is to make a datatype and a template once, then re-use it without any modifications/manual input for that specific datatype.

Simply: Its the exact same thing with Vision templates regarding UDT’s. I just want to make a perspective version of it.
https://docs.inductiveautomation.com/display/DOC80/Template+Indirection#TemplateIndirection-UDTsinTemplates

Im just wondering if the feature is applied to the current patch or is it a feature to be introduced soon, because I can’t wrap my head around this as of yet

Update: updated screenshot to reflect Indirect Tag Binding instead of Expression Tag Binding, and updated View param key name to ‘instance_number’.

This attached View has a single argument which is used to dictate which instance of a UDT is used for populating the values of the Components in the View (the param key is instance_number, and it is referenced with view.params.instance_number within the binding dialogs).
UDTTemplateView.json (3.1 KB)
To use this View in your project:

  1. Download it.
  2. Use your preferred text editor to View the JSON content.
  3. Select the entire document Ctrl/CMD + A.
  4. COPY the selection Ctrl/CMD + C.
  5. Make a new View in your Designer project.
  6. Hold SHIFT and then right-click the named View node (not the root node).
  7. Select Paste JSON.

My UDT instances (one instance is also attached) all live in a directory named Experimentation, and each instance has member tags named “Address”, “Doors”, “Windows”, and “Wifi”.
UDTInstance.json (190 Bytes)

I’ve used Indirect Tag Bindings.


To import the Tag file:

  1. Download it.
  2. Click the Import Tag Icon in the Tag Browser (the arrow going into the backwards “C”).
  3. Specify the downloaded file.

From the screenshot, you can see that I’ve specified which UDT Definition to use, and all I’m passing into the View “template” is the instance number I would like to use within the template.

The Indirect Tag Binding issue I mentioned was due to my personal variable name; please attempt to use Indirect Tag Bindings for use cases like this - just don’t include underscores in the REFERENCE name.

Hi,

Got that working, thanks alot!

However, can come quite frustating managing all the paths if you have a project with 10-30k+ tags using the same symbols over and over again with different values.

Do you know if Perspective will get the same template+UDT function like Vision already have?

I have tried making a drop-target, but I get the “Wrong Json” format error.

This is what causing the error, following the steps you described on first reply:

When I try to apply I this error comes up:

With the following details:
IllegalArgumentException: No enum constant com.inductiveautomation.ignition.common.sqltags.model.types.DataType.House

Ignition v8.0.0-beta0 (b2018121302)
Java: Azul Systems, Inc. 11.0.1

Ah, yes, it looks like UDTs are not ready for Perspective. My mistake - I thought they were.

It looks like for now your best option is to place the components you plan on using into your “template” View, then dragging the individual tags inside of the UDT into the desired component’s properties in the Property Editor. You would then want to modify the created binding and set the dynamic portion of the UDT Instance name (in my case, instances became MyHouse1 and MyHouse2) to be interpolated based off of the View param (so my Tag Binding would become INDIRECT, and my path would look like Experimentation/MyHouse{instance_number}/Address).

The “template” functionality as you know it from Vision does not exist in Perspective as of now, and it doesn’t sound like it will be ready for 8.0.

1 Like

Ah okey, thanks for the information :slight_smile:

Yes, im using ur method until the template/udt function is ready. Thanks alot for that input!

The reason I love that function, is because I have over 300 rooms to design, where the tags are in different paths.

But since im just testing its no problem at all, I love Perspective !

1 Like

Hello, I’m trying to work through this concept right now. Has there been any movement on this feature with 8.06? I’m gathering that ‘views like templates’ are ‘not’ available yet with complex UDT’s with drop targets?

No, it’s not available yet. To my knowledge we have not moved on that feature, as we’ve been prioritizing previous commitments like the features we declared as goals during the roadmap reveal at ICC.

1 Like
  1. Instead of using instance_number to replace the ”1” in MyHouse1, I want it to replace MyHouse1 so I can just type in the tag on every instance. The indirect tag reference generates an error in this case. Is this a bug?
  2. I have created a view which is a “template” for a UDT. I then created a main view and dragged and dropped the template UDT into the main view. I then changed the parameter(Instance number). Is this how perspective is used to work?
  3. With vision, there is a template and when clicked it passes parameters to a popup (parameters or indirect addressing). I tried doing this with perspective with no luck. Could you provide any suggestions

It depends on what the error is and what your Tag directories look like. Without those two pieces of information, I can’t help you. Please consider attaching a screenshot of the error provided by the binding window, as well as a screenshot of the Tag you are targeting.

I’m not sure, because I don’t even know if UDTs are now working on “drop” in Perspective.

I don’t even know what you’re referring to with regard to a popup which has been passed parameters after clicking a template. Again, could you provide a screenshot?

screenshot responses.pdf (507.7 KB)

Thanks for your response.
I have attached additional info

Okay.
Issue 1:
If your Indirect binding is specified as [default]{instance_number}/Address and you have the referenced param which contains a value of 1, then your binding is looking for a Tag with a path of [default]1/Address, which it’s not finding, so you get the Bad_NotFound error. This is a result of you removing “MyHouse” from the referenced path. If you want to supply your own tag, then you need to supply a different referenced variable. Something like this:

[default]{some_other_param_here}{instance_number}/Address

where the templated View has an additional param with a key of some_other_param_here.

Issue 3:
This is actually just using the templated View to open a Popup. This can be done by configuring an Event somewhere within that View to use either the Popup Action (documentation) or a Script Action which then itself uses system.perspective.openPopup() (documentation) . The complicate part here is that you can’t just place the Event on the View - it needs to be on one of the child components (or maybe the View’s root component and ALL of the child components if you just want the user to be able to click anywhere in the templated View to open the Popup).

For issue 2, I think I understand what you are asking but want to confirm. You want to be able to use a flex repeater that accepts only a parameter of instance to be able to show information for multiple UDTs with a specific base path. Is that accurate?

If so, I would avoid using the dropConfig.udts part of the configuration as it won’t get you what you are looking for at this time. If you are looking to create a read only Embedded View for a UDT, the configuration would look like the following:


You would create two Params (or you could exclude tagPath if you are certain the base path won’t change) that would make up the entire address you are attempting to use for the linked UDT. Then you would create an indirect binding on the custom udt properly to the .jsonValues property of this tag. This is a special property added in 8.0 that allows recursive readOnly bindings of all tags in a folder (which a UDT Instance essentially is).

Once you have configured this, you can configure components within the view like the following:
Screen Shot 2020-06-26 at 3.09.49 PM
Where ForEditTests is the name of a member tag in my UDT.

This doesn’t get you bi-directional support, but it wouldn’t be hard to add as you could do indirect bindings directly to the UDT member properties like the following without much more additional effort:

Garth

perspective_2020_06_27_1245.zip (38.6 KB) tags.json (9.2 KB) UDTs and templates.pdf (623.9 KB)

Here is what I am trying to accomplish:
I have a UDT called “House” with different members
I have 2 instances of this UDT: MyHouse1 and MyHouse2
I want to create a shape template which when clicked opens a template faceplate.
I will have a main view with different instances of the shape template. The main view will have 2 embedded views: One for MyHouse1 and another for MyHouse2
Perspective does not have a “template” like vision. It only has views. I made a “template” view called Shape_Template2

Please see attachment for screenshots. I have also attached my project and tags for reference
Issues:
For perspective,I have pieced this together from videos and forms. There is no specific video for doing this. Is this the correct approach? Vision has very specific steps on doing this.
From other forms in vision, passing the entire UDT is very heavy on the system so I have used indirect addressing.
My application can have up to 30-40 embedded vies in a view. Will my solution result in any performance issues?
Is there a better way to do this?
Currently I can only open up one faceplate at a time

ShapeFacePlate.zip (44.0 KB)

I have attached something that will do what you are asking. This will allow you to:

  1. Drag/Drop a House UDT to the view from the Tag browser and have the correct bindings
  2. When clicking Open Faceplate, the popup will display the correct information

The main issues I saw:

  1. The indirect bindings in Shape_Template2 would have caused additional bindings that shouldn’t have been needed. I updated them to reference the properties being passed by the dragged/drop UDTs. It should be noted that by dragging and dropping a UDT, instance_number is actually an indirect binding to the jsonValues property of the UDT instance path. The UI doesn’t help too much with allowing you to select the properties like with Vision Templates, so you have to manually type out the member name. Note that there is an open bug where spaces in member names cause this to break, so I would advise against using spaces in Member names at this time.
  2. In Shape_Faceplate2, what was being passed to the parameter was an indirect binding to MyHouse1.jsonValues, not just 1. You can probably understand the cascading issues this would cause. Just like in step 1, I just bound the components to the correct property.

To answer your question on if this will cause performance issues or not, the answer is it depends. The UDT size will play a large part in the performance aspect. When binding things this way, you are subscribing to every tag in the UDT and the system is returning it as a single JSON payload. The more members the UDT has, the larger this payload and the more often it could change. You can see how this could result in a greater chance of a performance hit. If you aren’t using all of the udt members in your view, this is unneeded traffic being sent and it might be more performant to just send the UDT Instance Path and do indirect subscriptions instead. I have included an example of this in the shape_...3 views included (note the lack of drag & drop). I did provide an example of using the Flex Repeater in the Main View to demonstrate how this would work. Also note that the indirect view would provide an option to allow writes where the jsonValues subscription is Read Only.

Hopefully this helps you better understand how to approach this issue.

Garth

UDT and Templates- follow up.pdf (394.1 KB)

Thanks for the valuable insight and taking the time to look at my project. I just wanted to clarify a few points. Please see attachment

I think most of you confusion lies in what is is actually being placed into the parameter when the embedded view is created. Hopefully the following helps:

When doing Drag and Drop (which is setup in the area noted in clarification point 3), the parameter being passed to the embedded view looks like the following screenshot and instance_number is an object when the dropConfig.udts.action value is binding:

In the new example provided, the way I configured the embedded view it only expected a String value that is a path to the tag which occurs when the dropConfig.udts.action value is path:

All of the properties being passed from these views to the faceplate rely on passing the type of object into the view you are opening which is the main thing that I modified.

As for the removal of the dropConfig, I am not sure why I removed that piece from my new example rather than just updating it to look like this.:
Screen Shot 2020-06-28 at 1.38.18 PM

With the action key set to path the dragging and dropping of the tag from the tag browser creates the embedded view like you are expecting.

Garth

1 Like

latest_ignition_solution_2020-06-28_1827.zip (73.6 KB) UDT and Templates- follow up2.pdf (227.0 KB)

I modified Shape_Template3 to have the dropconfig.
I see 3 approaches to adding a template view to the main view. Please see attached screenshots and project
My project will not have the shape templates in a column or row, rather they will be scattered.

What is the best solution for me

UDTDropExamples.zip (97.6 KB) tags.json (3.5 KB)

There are only 2 distinct ways to bind Views to UDTs.

All 3 of the options you have listed are basically doing the same thing which is binding the View’s components to a Tag Path indirectly. Your template wasn’t configured properly which is why the drag & drop didn’t work. Please see the attached export with changes and additional information.

In the attached project export, I added the second way that things can be done which is via the parameter bindings, which is what we had with Template2.

As for what to use:
The first thing you will want to do is choose if you want to use Parameter or Indirect bindings. The main difference at this point is parameter bindings are going to be Read Only for the foreseeable future.

Second thing is to determine if you can use a flex repeater or not. If a flex repeater fits your needs, then create a script to populate your instances. If it doesn’t, then use drag and drop to create you embedded views.

Garth