Hi Thenmozhi,
As Senthil, mentioned in this thread , the object design needs to be clear.
For example, it seems like you are reading in actuals from a third party system in a custom object, are you storing the actuals , per day in separate rows ? Is the actuals being stored in a single column for respective dates.
For example , lets say you are storing the actuals on a per day basis , in separate rows :
By SQL approach you , write a query which compares the column , in this case "act_test" (supposedly holding the actual values), the following basic SQL could help you to get the previous and latest value, based upon the latest entry made. (Please note this query is just for example purpose, if you have bulk data then you will need to use Lag over partition , or Rank functions. You can check online examples for syntax)
Query 1:
SELECT *
from
(select rownum r1, act_test from odf_ca_sam_test_obj)t1,
(select rownum r2, act_test from odf_ca_sam_test_obj)t2
Where t2.r2 = (t1.r1 - 1)
And t1.act_test <= t2.act_test
Output:
Based upon your requirements that is previous value of actuals less than (<) or greater than (>) latest entered value, you can accordingly introduce a case statement in the SQL:
Query 2:
SELECT
(case when t1.act_test <t2.act_test then (t1.act_test - t2.act_test) else (t2.act_test - t1.act_test) end) test
from
(select rownum r1, act_test from odf_ca_sam_test_obj)t1,
(select rownum r2, act_test from odf_ca_sam_test_obj)t2
Where t2.r2 = (t1.r1 - 1)
And t1.act_test <= t2.act_test
Output:
Based upon your requirement you could either embed such queries in the GEL script and then XOG in the difference.
Otherwise, you can get all values in an initial SQL statement, similar to query 1, in the GEL script, store in variables and test it out in the GEL script, using the Core : IF tags
Example:
<core:if test="${act_test < act_test_1}">
Then do this...............
</core:if>
<core:if test="${act_test > act_test_1}">
Then do this...............
</core:if>
Hope this helps.
Regards,
Samik