# Perspective user preference

**URL:** <https://forum.inductiveautomation.com/t/perspective-user-preference/101445>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [January 27, 2025, 7:30pm UTC](https://forum.inductiveautomation.com/t/perspective-user-preference/101445 "2025-01-27T19:30:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_Qaiser](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@S\_Qaiser](https://forum.inductiveautomation.com/u/S_Qaiser)\
**Post date:** [January 27, 2025, 7:30pm UTC](https://forum.inductiveautomation.com/t/perspective-user-preference/101445/1 "2025-01-27T19:30:40Z")

</div>

Is there any way to store user preference in a cookie or some db?  
I have some user preferences like excluding some dates from a filter and want to maintain the preference when a user logs back in.

---

<div class="post-metadata">

**Author:** ![dillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon/32/81537_2.png) [@dillon](https://forum.inductiveautomation.com/u/dillon)\
**Post date:** [January 27, 2025, 7:34pm UTC](https://forum.inductiveautomation.com/t/perspective-user-preference/101445/2 "2025-01-27T19:34:32Z")

</div>

You can definitely use a database connection and access it via [system.db.\* functions](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-db).

As for cookie storage, not sure it's a thing yet with Ignition perspective. I used the search function on this forum and found this for you though.

[Perspective: How to cache information between client sessions - Ignition - Inductive Automation Forum](https://forum.inductiveautomation.com/t/perspective-how-to-cache-information-between-client-sessions/26939)

[Cache data between Perspective sessions on same device | Voters | Inductive Automation](https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/cache-data-between-perspective-sessions-on-same-device)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 27, 2025, 7:38pm UTC](https://forum.inductiveautomation.com/t/perspective-user-preference/101445/3 "2025-01-27T19:38:11Z")

</div>

Nothing with cookies yet, you'll have to utilize your DB and session custom properties.

> [@Save/restore component properties to DB](https://forum.inductiveautomation.com/t/save-restore-component-properties-to-db/88383/9):
>
> Correct. To make it sticky, save/load from the DB. I'd say this is much easier and more transparent than diving into using SDK functions, especially if you get another engineer who knows nothing about the project/customization data. (That's my opinion anyways). It would also essentially 'live' in only one or two places, the session startup handler and the user id value change event, as opposed to every component that needed some sort of customization. You could have a structure something alo…

---

<div class="post-metadata">

**Author:** ![flexware](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/flexware/32/66243_2.png) [@flexware](https://forum.inductiveautomation.com/u/flexware)\
**Post date:** [January 27, 2025, 8:59pm UTC](https://forum.inductiveautomation.com/t/perspective-user-preference/101445/4 "2025-01-27T20:59:57Z")

</div>

What type of user source are you using? If you're using the Database user source (or any hybrid that involves the database), you can easily create a new table and make a foreign key constraint to the user table that has a user ID as a primary key.

For instance, one way to set up a user source would be to use a Database source with the Automatic option (that creates the DB model for you). After you create it, there are a few ways to proceed:

- You can create another table, maybe called `user_preference` in your DB and then foreign key to the `users` primary key.
- You can use the pre-built `user_ex` table to store additional properties. Refer to the docs [here](https://docs.inductiveautomation.com/docs/8.1/appendix/reference-pages/ignition-database-table-reference#authentication) to see the table structure.

-OR-

You could create a Database source in Manual mode, in which case you would have full control over the `user*` tables. Then you could create as complex of a `preferences` relationship to the user as you want. This requires some SQL knowledge.

This is, of course, just an example of a specific scenario that may or may not apply to you. I just wanted to point this out as an option for future viewers that are looking for options. We have run into this exact scenario many times, and we've approached it basically how I lined out above.

---

<div class="post-metadata">

**Author:** ![S\_Qaiser](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@S\_Qaiser](https://forum.inductiveautomation.com/u/S_Qaiser)\
**Post date:** [January 27, 2025, 9:36pm UTC](https://forum.inductiveautomation.com/t/perspective-user-preference/101445/5 "2025-01-27T21:36:00Z")

</div>

@flexware it is some filter that users can apply on a report, I want to save them for the user every time when he comes back at it. Its more like excluding some dates from the analysis when there is a non production day.  
I like the idea @ryan.white mentioned in the other thread as storing session properties in a db and then loading them when a user logs back in.
