#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Options

# flowfield problem

Member Posts: 267
edited 2005-08-24
Hi

I have two tables

1. "Employee"
"No.";"Fund. wage"

And

2. "Emp. Fund. wage"
"Date";"Emp No.";"Amount"

I want field "Fund. wage" in first table shows "Amount" from second table where Date is highest. and "emp no=no."

I think it is impossible but I better ask first

Thanks.

• Options
Member Posts: 246

1) Extend "Employee" to include a "Fund. Wage Date" field, flowfield CalcFormula=MAX("Emp. Fund. wage".Date WHERE "Emp. No." = FIELD("No."))...

2) Now, Employee."Fund. wage" could be a flowfield CalcFormula=LOOKUP("Emp. Fund. wage".Amount WHERE "Emp. No." = FIELD("No.") AND "Date" = FIELD("Fund. Wage Date"))...

But, now the correctness of (2) depends on (1) being calculated first... Hmm...
• Options
Member Posts: 45
Hi there,

I will answer this on the basis that when you say that the Date is the "highest", you mean the latest?

I believe all you need to do is on the "Emp. Fund. Wage" table is set the primary key to be "Emp No.",Date. Then you make the "Fund. Wage" in the "Employee" table a flowfield, and the
CalcFormula=MAX("Emp. Fund. wage."Amount WHERE "Emp. No." = FIELD("No."))

By using MAX, it is finding the last Emp. Fund. wage entry based on the primary key (Which is Emp No and Date), but since the Employee number is restricted to the one Employee we are looking at, it should find the last Dated entry for that Employee.

In the case you wanted to find the earliest Dated entry for that Emp. Fund. wage, all you would need to do is change the MAX in the CalcFormula to MIN.

Hope this helps.
• Options
Member Posts: 267
Hi