This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Export CSV
#4
(25.11.2020, 13:15)admin Wrote: I'm not sure that filtering function is correct, try replacing it with this:
Code:
-- Check if all trends or selection neeed to be exported
if export_all == false then
  tmp = {}
  for _, t in ipairs(trends_table) do
    for _, name in ipairs(trendnames) do
      if name == t.name then
        tmp[ #tmp + 1 ] = t
      end
    end
  end
  trends_table = tmp
end

-- Check if the is at least 1 trend to be exported


there is something wrong here:


Code:
  for _, row in ipairs(trenddatamonth) do
    stamp = dates['start'].year .. '-' .. dates['start'].month .. '-' .. string.format("%02d", _)
        local y, m, d = stamp:match("(%d+)%-(%d+)%-(%d+)")
        local t = { year = y, month = m, day = d}
   
    n15 = tonumber (string.format("%02d", _))*60*15
   
    modulo = n15*15

   
    hours1 = string.format("%02.f", math.floor(n15/3600));
    mins1 = string.format("%02.f", math.floor(n15/60 - (hours1*60)));

    Ora = hours1..":"..mins1
   
   
   
    -- format csv row
   csv = string.format('%q,%q,%q', string.format("%02d", dates['start'].day) .. "-" .. string.format("%02d", dates['start'].month) .. "-" .. dates['start'].year, Ora, row)
    -- add to buffer
    table.insert(buffer, csv)
  end

Because time are over the 24 hours:

Reply


Messages In This Thread
Export CSV - by gdimaria - 25.11.2020, 12:06
RE: Export CSV - by admin - 25.11.2020, 13:15
RE: Export CSV - by gdimaria - 26.11.2020, 17:27
RE: Export CSV - by gdimaria - 26.11.2020, 14:31
RE: Export CSV - by admin - 27.11.2020, 08:20
RE: Export CSV - by gdimaria - 27.11.2020, 08:55
RE: Export CSV - by Domoticatorino - 11.12.2020, 15:13

Forum Jump: