Max date within a SELECT function

So I have a table, Productions, with 3 columns: datetime, ID, production. When this table has a new insert, it kicks off a workflow that kicks off an Action. I want the Action to gather the one new ID field that was part of the row that was inserted into the Productions table. Iโ€™ve attempted multiple variations of a SELECT function using MAX and MAXROW on the datetime column but no luck. Any suggestions? Iโ€™m putting this expression in the โ€œReferenced Rowsโ€ field of the Action. Thanks very much.

Solved Solved
0 7 3,276
1 ACCEPTED SOLUTION

Not quite. The workflow gets the row automaticallyโ€“thatโ€™s just how workflow works. The workflow then invokes a configured action on that row, so the action gets the row specifically because the workflow gives the action the row. From there, other actions invoked by that initial action are only aware of the row theyโ€™re invoked againstโ€“and thatโ€™s entirely up to you to determine.

What it appears youโ€™re trying to do is to respond to a change in Productions table by updating some corresponding entry in the Inventory table. You noted:

Thatโ€™s 100% correct.

Also 100% correct, assuming the value of the IT CLP column of the row from the Productions table is a Ref to a row in the Inventory table.

This is entirely where the breakdown is. Any given action is only aware of the row it was invoked for, but knows nothing about the row it was invoked from. The Update Drive Status action is invoked from a row in Productions for a row in Inventory (the row identified by [IT CLP]), so Update Drive Status is only directly aware of the row in Inventory. You understood this, and were rightly trying to determine what row in Productions triggered the workflow. You simply chose a wrong approach in not understanding what Productions[Production] meant.

This takes us back to thisโ€ฆ

Unfortunately, youโ€™re gong to have to do just thatโ€“thereโ€™s no other option. In my experience, you likely wonโ€™t have to worry about a race condition. It seems that workflow is transactional, so nothing outside the workflow should be updating your data while the workflow is running.

If thatโ€™s not good enough for you (and I can understand why it wouldnโ€™t be), the alternative is to avoid workflow and attempt to perform all the actions from within the app itself with a Form Saved action, and/or by chaining the Inventory update actions to any existing actions that update Productions. The goal would be to organize the actions so they all run within the app directlyโ€“where thereโ€™s no contention with other users, and no chance for a race conditionโ€“rather than in a workflow.

View solution in original post

7 REPLIES 7
Top Labels in this Space