Workflow Related list to father List Values previous row and next row

Good Afternoon All,

I have acreated a workflow,

In this workflow I have various conditions.

I have my Father Row (triggers the workflow)
This row has a list of related rows

as I iterate through these related rows in the template, I need to crearte various tables, but this depends on the row values before and after the row. How would I see what the values of certain columns are in the row previous and the next row of the list?

Having some trouble with this one, :face_with_raised_eyebrow:

Thanks,

It might help us to know hat sort of report this is. Why would a row care what comes before and after?

In my rows I have an action type,

Action Type are:

  1. Add ingredient
  2. Mix
  3. Add Water

If the Action is Add ingredient and the action before was Add ingrediant, I need to keep them together, if the step before was water or mix, I need to start a new process. New Table. I can do all this no prob, but I just need to be able to see what the values of the row before were.

Im more or less creating a batch sheet and need to group items together until a next step comes into play.

1 Like

Are the rows arranged in any particular order for the report? If so, how?

The User has Created the recipe, so they are in the order the user created the Recipe. They need to Stay in the Same order.

Trying to get this. So Looking at the row before, is the action of same type, if so keep in the same group/Table, otherwise start new table. I can do all of this.

Just need help seeing what the value of the action was of previous row

Ingrediant
Ingrediant
Ingrediant
Ingrediant

Mix slow
Mix Fast

Ingrediant
Ingrediant

Add Water

Mix Fast

Ingrediant
Ingrediant

1 Like

To get the value of the column column from the immediately-preceding row:

ANY(
  SELECT(
    table[column],
    (
      [_ROWNUMBER]
      = MAX(
        SELECT(
          table[_ROWNUMBER],
          AND(
            (...),
            ([_THISROW].[_ROWNUMBER] > [_ROWNUMBER])
          )
        )
      )
    )
  )
)

Replace table (twice) and column appropriately. Replace ... with an expression that matches only rows of the same recipe.

The get a column value from the immediately-following row, replace this:

MAX(

and this:

([_THISROW].[_ROWNUMBER] > [_ROWNUMBER])

with this:

MIN(

and this:

([_THISROW].[_ROWNUMBER] < [_ROWNUMBER])
1 Like

Wow Steve,

So I filled in the blanks :wink: and this is what Im getting

I am taking it from an enum Column to a text column but this shouldn’t matter. Base Type of Enum is Text.

1 Like

Whoops! My expression was missing an equal sign between [_ROWNUMBER] and MAX(. I’ve revised my post above.

1 Like

Awesome,

You should add this to your tips and tricks section :wink:

1 Like