07.04.2017, 11:25
Improved example
Code:
rows = {}
-- from 1/1/1 to 1/1/30
addrstart = 1
addrend = 30
rows[ #rows + 1 ] = 'name,actual_value,start_month,current_month,previous_month'
for i = addrstart, addrend do
actual_value_obj = grp.find('1/1/' .. i)
name = actual_value_obj.name
actual_value = actual_value_obj.value
start_month = grp.getvalue('1/2/' .. i)
current_month = grp.getvalue('1/3/' .. i)
previous_month = grp.getvalue('1/4/' .. i)
rows[ #rows + 1 ] = name .. ',' .. actual_value .. ',' .. start_month .. ',' .. current_month .. ',' .. previous_month
end
csv = table.concat(rows, '\r\n')