07.02.2019, 08:46
Code:
rows = { 'name,actual_value,start_month,current_month,previous_month' }
function pushrow(i)
local actual_value_obj = grp.find('3/1/' .. i)
local name = actual_value_obj.name
local actual_value = actual_value_obj.value
local start_month = grp.getvalue('2/1/' .. i)
local current_month = grp.getvalue('4/1/' .. i)
local previous_month = grp.getvalue('1/1/' .. i)
rows[ #rows + 1 ] = name .. ',' .. actual_value .. ',' .. start_month .. ',' .. current_month .. ',' .. previous_month
end
-- from 3/1/1 to 3/1/15
for i = 1, 15 do
pushrow(i)
end
-- from 3/1/20 to 3/1/30
for i = 20, 30 do
pushrow(i)
end
--csv = table.concat(rows, '\r\n')
csv = string.char(0xEF, 0xBB, 0xBF) .. table.concat(rows, '\r\n')