Combination of a PU_MIN function and a lookup

Hi everyone,

I hope someone can help me in this case.

Parenttable: “AFKO”
Childtable: “Activity_Table”
Necessary columns within the Activity table: “Activity_Start” , “Delay”

At first I want to search for the smallest value of “Activity_Start” for each Case in “AFKO”:
PU_MIN(“AFKO”,“Activity_Table”.“Activity_Start”)

Next, I want to get the corresponding value of “Delay”.

How must a formula look like?

Thanks for your help!
Alex

Hi Alex,

You could use a PU_FIRST to return the first “Delay” value of the case where the “Activity_Start” value equals the minimum “Activity_Start” value. This would look like this:

PU_FIRST("AFKO", "Activity_Table"."Delay",  
"Activity_Table"."Activity_Start" = PU_MIN("AFKO", "Activity_Table"."Activity_Start" )

Note that in this solution, when the smallest Activity_Start value occurs multiple times within one case, the first corresponding “Delay” value is returned. You can use PU_LAST to get the latest corresponding “Delay” value.

Hope this helps!

Cheers
David