# Datasource as option

**URL:** <https://forum.inductiveautomation.com/t/datasource-as-option/95130>\
**Category:** Module Development\
**Tags:** ignition81, perspective\
**Created:** [August 25, 2024, 8:20pm UTC](https://forum.inductiveautomation.com/t/datasource-as-option/95130 "2024-08-25T20:20:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [August 25, 2024, 8:20pm UTC](https://forum.inductiveautomation.com/t/datasource-as-option/95130/1 "2024-08-25T20:20:34Z")

</div>

I have a component that works well and grabs data using the gateway to process or return to the component through delegates, but I need to pass in a datasource for what DB to grab the data from.

Is there a good way in the `componentName.props.json` file to show all the available datasources in the gateway or select default as an enum?

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [August 25, 2024, 9:15pm UTC](https://forum.inductiveautomation.com/t/datasource-as-option/95130/2 "2024-08-25T21:15:00Z")

</div>

I believe you could use this mechanism:

> **[PropertySuggestionSourceRegistry](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.38-rc1/com/inductiveautomation/perspective/designer/api/PropertySuggestionSourceRegistry.html)**
>
> declaration: package: com.inductiveautomation.perspective.designer.api, interface: PropertySuggestionSourceRegistry

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 26, 2024, 12:13am UTC](https://forum.inductiveautomation.com/t/datasource-as-option/95130/3 "2024-08-26T00:13:34Z")

</div>

That sounds **terrible** and very un-Ignition-ish. Just accept a dataset property or a list of dictionaries--let the **designer** bind to actual data. Define the **structure** required.

(The IA components that do their own queries are the most annoying in the entire kit.)

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [August 26, 2024, 12:28am UTC](https://forum.inductiveautomation.com/t/datasource-as-option/95130/4 "2024-08-26T00:28:18Z")

</div>

So for example,

If I have a scripting function that goes out and gets the downtime data from our database as an option. You are suggesting it is better to not have a component that fetches that, and instead just accepts the data? I suppose, we were thinking about the Sepasoft model, but exceptionally faster, where their downtime table for example queries their database and displays the info.

I wanted to do something similar in terms of an easy drag and drop downtime table but allow actual customization.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 26, 2024, 12:31am UTC](https://forum.inductiveautomation.com/t/datasource-as-option/95130/5 "2024-08-26T00:31:39Z")

</div>

Yes, allow your users to bind to your `props.data` if suited, or to custom properties with further expressions, as they see fit, to allow customization that you cannot anticipate. Where possible, supply expression functions in addition to scripting functions, so scripting overhead can be minimized.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [August 26, 2024, 12:39am UTC](https://forum.inductiveautomation.com/t/datasource-as-option/95130/6 "2024-08-26T00:39:08Z")

</div>

Although this is the solution, I agree with @pturmel. Makes a lot of sense, and I feel it is why we always end up just using the data from 3rd party module components like Sepasoft and making a more customizable component in Ignition. Thanks for the feedback both of you.
