# Generating Perspective View Components Dynamically

**URL:** <https://forum.inductiveautomation.com/t/generating-perspective-view-components-dynamically/29006>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 10, 2019, 7:14pm UTC](https://forum.inductiveautomation.com/t/generating-perspective-view-components-dynamically/29006 "2019-10-10T19:14:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amansour](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@amansour](https://forum.inductiveautomation.com/u/amansour)\
**Post date:** [October 10, 2019, 7:14pm UTC](https://forum.inductiveautomation.com/t/generating-perspective-view-components-dynamically/29006/1 "2019-10-10T19:14:08Z")

</div>

I’m currently using Perspective as a way to go paperless by building form views that save data to the database when a user fills it out. For example, a daily maintenance form.

This works well so far, however I want the form to be customizable from the database. That way an external program or a user without access to Ignition designer can configure a database table called “form\_items” whenever a form field needs to be added or removed.

I can handle all the database calls and other scripting in python easily, but I’m stuck at how to add a child component to the root programmatically.

I tried setting `self.children = [...]`, but the field is read-only. Is there any way to add a component to the screen programmatically on startup?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 10, 2019, 7:39pm UTC](https://forum.inductiveautomation.com/t/generating-perspective-view-components-dynamically/29006/2 "2019-10-10T19:39:39Z")

</div>

Sort of…

What you can do is make Views (ButtonView, CheckboxView, DropdownView) out of components. And you can make a View (ComponentChooserView) which contains only an Embedded View, where that Embedded View’s path is bound to a param. Then you can use a Flex Repeater with a path of ComponentChooserView where each instance receives params to define the View to use.

The really complicated part is also providing the options for each of the components; for example, if you want a dropdown, you need to pass the dropdown all of the value:label pairs you want as options.

---

<div class="post-metadata">

**Author:** ![amansour](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@amansour](https://forum.inductiveautomation.com/u/amansour)\
**Post date:** [October 11, 2019, 7:42pm UTC](https://forum.inductiveautomation.com/t/generating-perspective-view-components-dynamically/29006/3 "2019-10-11T19:42:12Z")

</div>

Thanks a lot, I got that to work!  
It’s a little finicky, but it’s works well.  
Appreciate the quick response 🙂
