Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 46423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:57:49+00:00 2026-05-10T15:57:49+00:00

I have a question about best practices regarding how one should approach storing complex

  • 0

I have a question about best practices regarding how one should approach storing complex workflow states for processing tasks in a database. I’ve been looking online to no avail, so I figured I’d ask the community what they thought was best.

This question comes out of the same ‘BoxItem’ example I gave in a prior question. This ‘BoxItem’ is being tracked in my system as various tasks are performed on it. The task may take place over several days and with human interaction, so the state of the BoxItem must be persisted. Who did the task (if applicable), and when the task was done must also be tracked.

At first, I approached this by adding three fields to the ‘BoxItems’ table for every human-interactive task that needed to be done:

IsTaskNameComplete

DateTaskNameComplete

UserTaskNameComplete

This worked when the workflow was simple… but now that it has grown to a complex process (> 10 possible human interactions in the flow… about half of which are optional, and may or may not be done for the BoxItem, which resulted in me beginning to add ‘DoTaskName‘ fields as well for those optional tasks), I’ve found that what should’ve been a simple table now has 40 or so field devoted entirely to the retaining of this state information.

I find myself asking if there isn’t a better way to do it… but I’m at a loss.

My first thought was to make a generic ‘BoxItemTasks’ table which defined the tasks that may be done on a given box, but I still would need to save the Date and User information individually, so it didn’t really help.

My second thought was that perhaps it didn’t matter, and I shouldn’t worry if this table has 40 or more fields devoted to state retaining… and maybe I’m just being paranoid. But it feels like that’s a lot of information to retain.

Anyways, I’m at a loss as far as what a third option might be, or if one of the two options above is actually reasonable. I can see this workflow potentially getting even more complex in the future, and for each new task I’m going to need to add 3-4 fields just to support the tracking of it… it feels like it’s spiraling out of control.

What would you do in this situation?

I should note that this is maintenance of an existing system, one that was built without an ORM, so I can’t just leave it up to the ORM to take care of it.

EDIT:

Kev, are you talking about doing something like this:

BoxItems

(PK) BoxItemID

(Other irrelevant stuff)

BoxItemActions

(PK) BoxItemID

(PK) BoxItemTaskID

IsCompleted

DateCompleted

UserCompleted

BoxItemTasks

(PK) TaskType

Description (if even necessary)

Hmm… that would work… it would represent a need to change how I currently approach doing SQL Queries to see which items are in what state, but in the long term something like this looks like it would work better (without having to make a fundamental design change like the Serialization idea represents… though if I had the time, I’d like to do it that way I think.).

So is this what you were mentioning Kin, or am I off on it?

EDIT: Ah, I see your idea as well with the ‘Last Action’ to determine the current state… I like it! I think that might work for me… I might have to change it up a little bit (because at some point tasks happen concurrently), but the idea seems like a good one!

EDIT FINAL: So in summation, if anyone else is looking this up in the future with the same question… it sounds like the serialization approach would be useful if your system has the information pre-loaded into some interface where it’s queryable (i.e. not directly calling the database itself, as the ad-hoc system I’m working on does), but if you don’t have that, the additional tables idea seems like it should work well! Thank you all for your responses!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T15:57:49+00:00Added an answer on May 10, 2026 at 3:57 pm

    If I’m understanding correctly, I would add the BoxItemTasks table (just an enumeration table, right?), then a BoxItemActions table with foreign keys to BoxItems and to BoxItemTasks for what type of task it is. If you want to make it so that a particular task can only be performed once on a particular box item, just make the (Items + Tasks) pair of columns be the primary key of BoxItemActions.

    (You laid it out much better than I did, and kudos for correctly interpreting what I was saying. What you wrote is exactly what I was picturing.)

    As for determining the current state, you could write a trigger on BoxItemActions that updates a single column BoxItems.LastAction. For concurrent actions, your trigger could just have special cases to decide which action takes recency.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 272k
  • Answers 272k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There are 2 parts to your question: how to create… May 13, 2026 at 1:53 pm
  • Editorial Team
    Editorial Team added an answer Why note use XML serialization for what it is. Looping… May 13, 2026 at 1:53 pm
  • Editorial Team
    Editorial Team added an answer Much of the implementation of System.String is in native code… May 13, 2026 at 1:53 pm

Related Questions

I am currently playing around with the Asp.Net mvc framework and loving it compared
I remember reading once (I believe the book was the .NET Framework Design Guidelines)
we are about to start using EventLog as our Centralized Auditing solution. A problem
There have been several questions over the past few days about the proper use

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.