# Designing tables for arbitrary sequence inputted by user?

**URL:** <https://forum.inductiveautomation.com/t/designing-tables-for-arbitrary-sequence-inputted-by-user/61909>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [July 14, 2022, 3:41pm UTC](https://forum.inductiveautomation.com/t/designing-tables-for-arbitrary-sequence-inputted-by-user/61909 "2022-07-14T15:41:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 14, 2022, 3:41pm UTC](https://forum.inductiveautomation.com/t/designing-tables-for-arbitrary-sequence-inputted-by-user/61909/1 "2022-07-14T15:41:43Z")

</div>

More of a database design question but its directly tied to an Ignition project and I think people here will have more experience with this sort of problem than stack overflow.

Here’s the feature I am working on -

1. Let users create new sequence or load existing sequence. This sequence will be sent to the PLC to execute it in its entirety.
2. These recipes can be of arbitrary length, could be 3 steps, could be 20 steps.
3. Each of these steps is one of 6 step “types”
4. this is the tricky part where I am getting hung up on - each step has a variable number of parameters - step type 1 requires 4 parameters, step type 2 requires 2 parameters, etc

Right now my design would be as follows -  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/d/2d4ed748f8392ca8cb8976c5d0c7c5dca03923af.png)

My question is given that each step has a different number of different typed parameters, how would be the way to go about this?

I know one thing I _could_ do is make enough columns under `recipe_steps` for each potential parameter, most of which would be left NULL in any row as only the ones related to that step type would get filled in. However, this is not a performance critical part and if I can normalize the tables a bit I’d rather that, I am just struggling to think how that would work.

Or is making a bunch of extra columns like

`stepType1_param_1, stepType1_param_2, stepType2_param_1, ` etc in my recipe\_steps be the easiest best way to do it?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [July 14, 2022, 4:04pm UTC](https://forum.inductiveautomation.com/t/designing-tables-for-arbitrary-sequence-inputted-by-user/61909/2 "2022-07-14T16:04:07Z")

</div>

> [@bkarabinchak.psi](#):
>
> `stepType1_param_1, stepType1_param_2, stepType2_param_1, ` etc in my recipe\_steps be the easiest best way to do it?

If the sequence is going to be sent directly from the DB to the PLC, I would probably go with this. I might go with this any way, though if you're going to be doing any processing prior to the PLC then there is potentially an opportunity to store them in a more "processing" friendly way.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 14, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/designing-tables-for-arbitrary-sequence-inputted-by-user/61909/3 "2022-07-14T16:05:44Z")

</div>

Yea this works for sure. Seems reasonable enough. I’m thinking too if I did normalize it I might need a conditional join statement based on the step type which may be confusing to other maintainers, this way seems pretty straight forward for the next person.

I think I was probably overthinking it or being too attached to having it normalized.
