Question on SELECT expression: I have a task...

expressions
(Daisy Ramirez) #1

Question on SELECT expression:

I have a task list where the user inputs a task name and upon save, I’d like the system to update the task’s “action_type” field to the action_type of the most recent task with the same name. For example: If I input “buy ice cream”, the system pulls the action type of the most recent “buy ice cream” task.

Based on some reading here, I pulled together this expression:

ANY(SELECT(tasks_user_slice_ALL[name],[_RowNumber]=MAX(

SELECT(tasks_user_slice_ALL[_RowNumber],[name]=[_THISROW].[name]))))

Since ANY is considered a list expression, how do I go about grabbing the single task_action_type text I’m needing from the list to insert it into the field?

Any help would be great. Thanks

(Aleksi Alkio) #2

Best way to do this, is with MAXROW expression. Create a virtual column to your table with the app formula =MAXROW(tasks_user_slice_ALL,_rownumber,[action_type]=[_THISROW].[action_type]). It will create a ref type field where the result is the key value. Then you can call the name from that record like [VirtualColumnName].[NAME] in the initial value.

Using the rownumber is possible, but it’s a bad design. Instead of rownumber, you should use the DateTime field in the same way.