You need to sign in to do that
Don't have an account?
Populating a field based on previous entries
Hi,
I am using a custom object with data entered via email from an external form. Now, one field is the amount of cargo onboard a vehicle.
The problem is that this amount is only reported when the vehicle departs a given location, but is reported as zero in the intermediate reports until it departs a new location, upon which the amount of course changes.
For reporting purposes I need to be able to group all entries with the same amount of cargo, but I am not able to do this now. My idea is to make a new custom field (cargo_onboard) and (if cargo_departing=0) have the field search previous entries until it hits cargo_departing=greater than zero and then set cargo_onboard equal to this. But i cannot find the functionality in the custom formula field. Any ideas??
EDIT
This is further complicated because it must be able to seperate between different vehicles, using a spesific vehicle ID. This is one reason I have not been able to fix it using workflow rules..
Can you please help understanding the scnerio with some example?
Sorry for the confusing explanation.
Lets say I have the following records:
ID
Loading cargo
Cargo onboard
1
10
10
2
0
10
3
0
10
4
0
10
5
0
10
6
20
20
7
0
20
8
0
20
etc
Etc
etc
The first two columns are entered via email. The third column here shows how i want it to work, but i dont know how to do this. I want cargo onboard to be automatically filled with whatever was loaded onboard the last time. Hope this makes more sense.
so now for 1st and 6th there is no issue.
if (loading cargo > 0)
cargo onboard == loading cargo
else
{
here is the issue.
Question : how do you calculate cargo onboard for 2nd to 5th and 7th and 8th?
My guess : the older value for 'loading cargo' (value befor update)
}
Is my understanding correct?
Yes, that is exactly what i mean. Any ideas?
your issue can be solved in trigger as well as workflow rules.
in trigger you can get old instance (instance before change) of record using trigger.oldmap()
in workflow rule you can use Function PRIORVALUE(field) to get the old value of the field.
I am aware of this, and have tried using workflow+PRIORVALUE. The problem is i need to differentiate between different vehicles.
ID
Vehicle
Cargo Loaded
Cargo onboard
1
1
10
10
2
1
0
10
3
2
20
20
4
1
0
10
5
2
0
20
6
2
0
20
7
2
30
30
8
1
10
10
I think PRIORVALUE only sorts by the order in which records are created, in the above example this would be ID. Therefore it would not be correct since the records are created in a non-ordered way.