fecha=DateTime.Date(DateTime.Now)
hora=DateTime.GetHour(DateTime.Now)&":"&DateTime.GetMinute(DateTime.Now)
mes=DateTime.GetMonth(DateTime.Now)
año=DateTime.GetYear(DateTime.Now)
Dim su As StringUtils
Dim Cursor1 As Cursor
Cursor1 = informes.ExecQuery("SELECT FECHA, HORA, FASE, FRECUENCIA, FACTOR_DE_POTENCIA, VOLTAJE, CORRIENTE, POTENCIA, POTENCIA_REACTIVA, POTENCIA_APARENTE, ENERGIA, hola, TENSION_COMPUESTA FROM informe")
Dim list1 As List
list1.Initialize
For i = 0 To Cursor1.RowCount - 1
Dim cols() As String ' Try to move this line into the for-loop
Cursor1.Position = i
cols = Array As String(Cursor1.GetString2(0), Cursor1.GetString2(1), Cursor1.GetString2(2), Cursor1.GetString2(3), Cursor1.GetString2(4), Cursor1.GetString2(5),Cursor1.GetString2(6), Cursor1.GetString2(7), Cursor1.GetString2(8), Cursor1.GetString2(9), Cursor1.GetString2(10), Cursor1.GetString2(11),Cursor1.GetString2(12))
list1.Add(cols)
Next
Cursor1.Close
If list1.Size > 0 Then
su.SaveCSV2(File.DirRootExternal, "Informes_"&mes&"-"&año&".csv", ",", list1, Array As String("FECHA", "HORA", "FASE","FRECUENCIA", "FACTOR DE POTENCIA", "VOLTAJE","CORRIENTE", "POTENCIA", "POTENCIA REACTIVA","POTENCIA APARENTE", "ENERGIA", " ", "TENSION COMPUESTA"))
Else
ToastMessageShow("No hay datos suficientes",True)
End If