# Writing to Database from Perspective

**URL:** <https://forum.inductiveautomation.com/t/writing-to-database-from-perspective/80215>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 9, 2023, 5:02pm UTC](https://forum.inductiveautomation.com/t/writing-to-database-from-perspective/80215 "2023-10-09T17:02:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwclassen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mwclassen/32/53171_2.png) [@mwclassen](https://forum.inductiveautomation.com/u/mwclassen)\
**Post date:** [October 9, 2023, 5:02pm UTC](https://forum.inductiveautomation.com/t/writing-to-database-from-perspective/80215/1 "2023-10-09T17:02:08Z")

</div>

I'm new to Ignition, so this post is a little just to get started here.

I'm not as interested in the 'how to' as much as the feasibility of my current project. I want to create a form/page/pages in Perspective that will have something like 600 checkboxes to create a checklist for a project. I'm hoping that I can have multiple users 'checking' items at the same time from different devices, so each change would need to be saved 'onBlur'. I need to pull up the pertinent checklist for a project at any given date from a list of multiple projects. I will also have two text fields for each row that need to save values 'onBlur'.

Some may say, "use a spreadsheet." I want to use Ignition because we are starting to use Ignition in our company for SCADA systems, I really like the database portion, and I want to expand the checklist to be able to save project data for future reference.

1. Is Perspective an option for creating this project?
2. Can multiple users be on the same 'session' from different devices at the same time?

mwclassen

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [October 9, 2023, 5:45pm UTC](https://forum.inductiveautomation.com/t/writing-to-database-from-perspective/80215/2 "2023-10-09T17:45:43Z")

</div>

Hello,

Yes perspective could be leveraged for this.

1. Look into flex repeaters to build out your check boxes dynamically via script. Create an embedded view with a check box that takes a tag path parameter.

[https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Flex+Repeater?gclid=CjwKCAjwyY6pBhA9EiwAMzmfwfAZcDszUDyrmJd9dvXdl6-1HXSifM7z2zurHCvxLDEiw6Wr33\_jfRoC\_tYQAvD\_BwE](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Flex+Repeater?gclid=CjwKCAjwyY6pBhA9EiwAMzmfwfAZcDszUDyrmJd9dvXdl6-1HXSifM7z2zurHCvxLDEiw6Wr33_jfRoC_tYQAvD_BwE)

1. For the tag path mentioned above, create memory tags to hold the checkbox values. This way multiple sessions can see and modify the checklist simultaneously.

Regards,

Frank

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 9, 2023, 5:55pm UTC](https://forum.inductiveautomation.com/t/writing-to-database-from-perspective/80215/3 "2023-10-09T17:55:23Z")

</div>

> [@franklepkowski](#):
>
> Create an embedded view with a check box that takes a tag path parameter.

That idea crossed my mind too but it won't work well for multiple projects all writing to the same tags. I think each check needs to write directly to the database.

I'd be inclined to create a narrow table with the following columns:

- **id** (auto-increment, primary key)
- **projectName** (or projectId to look up in the project table)
- **taskName** (string)
- **value** (boolean if only two values but integer would give more options such as % complete)
- **username** (the culprit)
- **timestamp**

Use a named query to return the values to the form. The query for the project status would be something like,

```sql
SELECT 
  t.id,
  t.projectName,
  t.taskName,
  t.value,
  t.username, 
  t.timestampe
FROM MyTable t
INNER JOIN (
    SELECT projectName, taskName, max(timestamp) AS MaxDate
    FROM MyTable
    GROUP BY projectName, taskName
) tm ON t.projectName = tm.projectName 
  AND t.taskName = tm.taskName
  AND t.timestamp = tm.MaxDate

```

A table will probably do for display and data entry.  
You'll need some way to tell the other clients to update. The method escapes me right now - although I've done it before.

This database structure gives you the means to revert the project status to a particular time should it be accidentally corrupted. All sorts of other uses could be made of the structure to give timelines, etc., of when various events occurred and how the project progressed.

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [October 9, 2023, 6:00pm UTC](https://forum.inductiveautomation.com/t/writing-to-database-from-perspective/80215/4 "2023-10-09T18:00:06Z")

</div>

Ahh yes, I overlooked the bit of it being in a database.

---

<div class="post-metadata">

**Author:** ![mwclassen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mwclassen/32/53171_2.png) [@mwclassen](https://forum.inductiveautomation.com/u/mwclassen)\
**Post date:** [October 9, 2023, 7:04pm UTC](https://forum.inductiveautomation.com/t/writing-to-database-from-perspective/80215/5 "2023-10-09T19:04:54Z")

</div>

Thanks to both of you! This indeed answers my questions and I will continue working to that end.
