Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
javiervzaplana
Contributor
Contributor

Help Before in Script ETL

Hello! I need help, I have this code in a graphic but I want to write it in the ETL script


(sum(I_INDICADOR)+rangesum(before(sum(I_INDICADOR),1,12))+after(sum(IMPORTE)+rangesum(After(sum(IMPORTE),1,12))))


thanks!!!

2 Replies
shilpan
Partner Ambassador
Partner Ambassador

rangesum works both in script and chart but after works only in chart.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

You cannot translate this kind of expression 1:1 into a script statement, because

  • before and after are not available in your load script. There isn't even a function that comes close. You can however mimic this behavior using some pretty complex code, but that wouldn't be very efficient.
  • there is no object with rows/columns to pick values before() / after(). There is just a single internal table with rows that you can GROUP BY into another table.
  • in your expression you can easily aggregate fields from different tables, but in a script that would require explicit JOINS.

IMHO it would be better if you describe your internal table(s) in your data model and the expected output per set of GROUP BY fields. Would that be possible?