Hi Folks can someone help me on this issue, Im trying to do this within a portal FM15. like in this excel spreadsheet, Final result must be the initial amount in the next business day. thanks for your comments. regards
Does the portal have to be sorted? What happens if someone made an error and went back and edited a previous record?
Auto-enter on Initial field:
GetNthRecord ( Table1::Final ; Get(RecordNumber)-1 )
GetNthRecord always depends on correct sorting. I'd do this differently:
Create another instance of this table in the "Relationships" Manage Database view. I call it "yesterday".
Create a relationship from "original" to "yesterday" with both date fields:
yesterday::date < original:date
sort the "yesterday" table relationship by "Date" descending important!
Create a calculation field in the "original" context for "initial" using the relationship: = yesterday::final
Be aware that this always cascades through all records of this table.
If ArmandoG is always doing this within the portal in creation order, as shown and described,
Auto-enter GetNthRecord ( Table1::Final ; Get(RecordNumber)-1 )
on Initial field will work fine.
SteveMartino wrote: Does the portal have to be sorted?
Assuming creation order is on the date-of, no. But you would want to avoid creating records if there were some incompatible find or sort involved.
What happens if someone made an error and went back and edited a previous record?
If no one has to perform a find on it or join to it, it could be an unstored calculation instead,
but then it runs into the risk of having the wrong value if viewed under various find or sort conditions.
It should be stored, and if the other record's Final can be manually changed,
then a script should control the editing of Final (and Initial, if desired), either as a button or a trigger.
Retrieving data ...