Initial value for Enum field returning the next value from the list

Good afternoon!

I need to return the next value in a sequence, that is, in a training application I need to return the next training session performed by a given user as the initial value. For example, there is a list of training sessions, WORKOUT A, WORKOUT B, WORKOUT C, and the previous training session was WORKOUT C. In this case, I need the initial value returned in the next training session entry to be WORKOUT A.

I am using this method based on a suggestion from this community:

ANY(
SELECT(
treinoPrevisto[treino],[idPrev] = MAXROW("treinoPrevisto", "_RowNumber")
)
)

However, it only returns the last training session performed and not the one following it.

NOTE: the view already has a VALID IF with the user filter:
FILTER("treino",AND([user]=[_THISROW].[user],[status]="Aberto"))

How can I complement the formula so that TREINO A is returned?

 

Solved Solved
0 4 167
2 ACCEPTED SOLUTIONS

Treino Initial Value statement

SWITCH(
ANY(
SELECT(
treinoPrevisto[treino],[idPrev] = MAXROW("treinoPrevisto", "_RowNumber")
)
),
"Treino A", "Treino B",
"Treino B", "Treino C",
"Treino C", "Treino D",
"Treino D", "Treino A",
""
)

IF the list of workouts is added to then this statement will have to maintained as well. 

View solution in original post

Extending @Trevwiller 's solution, if you have more than one training sequence patterns, you create TRAINING PATTERN, TRAINING PATTERN DETAILS (parent child) tables where the DETAILS table would have fields like

ID, TRAINING_PATTERN_Ref, PREVIOUS_TRAINING, NEXT_TRAINING.

USERS table should recognize which pattern each user is training under.

View solution in original post

4 REPLIES 4
Top Labels in this Space