What do you want to do? Add new trend(1) or download the data(2) from existing trend and operation on this data?
If you want 1) add new trend you should use menu, this has nothing with scripting.
If you want 2) download data then you should do exactly what is in API. For example when you want download last year daily data of trend "Gas" you should paste in a script:
Then you can operate freely on such data(normal table). You can use it also in function. All is in the manual of Logic Machine and on:
http://openrb.com/docs/
If you want 1) add new trend you should use menu, this has nothing with scripting.
If you want 2) download data then you should do exactly what is in API. For example when you want download last year daily data of trend "Gas" you should paste in a script:
Code:
require('trends')
trend_name = "Gas"
-- get data for the past year
dates = {}
dates['start'] = os.date('*t')
dates['start'].year = dates['start'].year - 1
dates['end'] = os.date('*t')
-- fetch previous value
yearly = trends.fetch(trend_name, dates, 86400)
Then you can operate freely on such data(normal table). You can use it also in function. All is in the manual of Logic Machine and on:
http://openrb.com/docs/