[Question-Resolved] Perspective Components (Template)

Hi,

Is it possible to make a DataType a drop-target for a component/embedded view? Like in Vision.

I have searched the forum, and read the manual, but obviously I can’t seem to find any information regarding how to do it.

What im looking for is that when I have added alot of tags from my Data Types, I want to drag those datatypes into a view with everything set up out from a view-template

To set up Tag-Drop for a Datatype (including UDTs):

  1. In the Designer Menu Bar, select “Project”, and then “Project Properties”.
  2. In the resulting Project Properties Dialog, select “Tag Drop” in the Perspective category.
  3. Hover your mouse in-between two existing datatypes to trigger the “+” icon, which will allow you to add a new Datatype.
  4. The next step is counter-intuitive: you should select “Array”, as the next few steps are specifying what Components you would like to allow as options during a tag drop.
  5. Now click the “Add Array Element…” link and select “Value”.
  6. Components are specified here with the following format: “ia.<component_category>.<component_name>”, where component_category is lower-case from among “chart”, or “display”, or any of the available component categories, and component_name is the lower-case name of the component. Assigning a Table as an available option would require you to set the value as “ia.display.table” (note the lower-case use throughout).
  7. If the component you want to use for your tag-drop is not already included in the “bindings” portion of this screen (or if you want to fine-tune property-mapping), you will want to add it now as an array.
  8. Each “binding” array entry must be an object, and must include at least “tagProperty”, “propertyPath”, and “bidirectional” as values for the object. Each of these objects is used to map ONE property from your tag to the Component, and so propertyPath must be unique among the object listings.

To template a View from a UDT:
It is not possible to drop a UDT into a View and have the View magically take on properties from the UDT, but you can supply a UDT as a View parameter, and everything will work. To do this:

On an open View you want to use the UDT as a building block for, you will want to construct an incoming (or bi-directional, based on use-case) param by clicking the named View Node (not your root directory, but the actual View node which you specified a name for) and then adding a parameter in the Perspective Property Editor under PARAMS.
This parameter should include any values you want the View to use.

In the following screenshot I have specified a singular input parameter object which contains several values within it. This is the View which needs those value to construct itself. I have specified “default” or “fallback” values which will be used in the event that the value is not included as an outgoing parameter from the parent View; if the parent View does correctly supply all necessary input parameters, the the values I supply here will not be used, other than to help me construct the View in the Designer.

1 Like

Ok, thanks for the info, im still trying to wrap my head around that.

Maybe im misunderstanding the concept of creating a “readymade” template.
I will try more with the functions you posted above, but so far it seems like manually punching the values in a template is the only thing I get working at this stage, for now. I get the “component” to work, but I need to feed the values into the pre-set bindings manually.

Im gonna try to describe more of what function im after with more pictures in this post.
The feature im after is the same feature Vision has regarding “templates” and “datatypes”, where you had an option to “drop target” and pass along all the values from that datatype into a window.

First, Datatypes created:

After I have created the datatypes, I add them into my tags:

I have now created a view(coordinate view) called “Temperature”, it contains a symbol and a numerical display.
I have added my “Temperature” datatype under “dropConfig.udts”

I can now drag and drop my pre-made tags, and have the premade view appear like I want to.

Problem is getting the data into my display etc… as the actual data I want is outside the “template”.
If you see from the pic below, you can see that the data is passed along the “dragndrop” function via “test”, but I can’t figure out how to use that data to automatically apply to the display and the other binding I have.

I can ofcource bind the parameters manually to “this.props.params”, but that involves more punching and more risk of human errors.

What I can’t figure out, is how do I “script” the actual output of the “dropConfig.udts” before dragging it into a page?

Inside the premade view with the icon and numerical display, I can only access the param from the dropConfig, which return the “String” from what I manually write there.

I tought that since a dropConfig was added to a view, it was probably there to be used, like Vision’s templates drop-targets.

For the outgoing parameter from the “parent” View, did you try binding against the tag (including indirect binding)?

This still requires you to manually specify the properties/values of the tag you intend to pass through, but indirect binding should allow you to dynamically specify the UDT you want to use, as opposed to dropping the UDT into your View and targeting it with property binding.

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