Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello community,
I have faced an issue.
I need historical weather temperature. To do so I decided to create my own data set.
I found out a way to load today's temperature and to store it into the csv but I am struggling to find a reasonable way to add
another row the day before.
A:
LOAD
RowNo() as Nr
,@1 as Utena
FROM
[http://api.wunderground.com/api/d9d8ecf8bb9d2e11/conditions/q/CA/Utena.xml]
(txt, codepage is 1257, no labels, delimiter is ' ', msq);
LET vExA = '';
FOR vR = 0 TO NoOfRows('A')-1
LET vExA = vExA & Chr(10) & ',' & Chr(39) & Peek('Utena', vR, 'A') & Chr(39);
NEXT vR
tmp:
LOAD DISTINCT
Today() as Date
,Right(Left(Pick(51 $(vExA) ), len(Pick(51 $(vExA) )) - 9), len(left(Pick(51 $(vExA) ), len(Pick(51 $(vExA) )) - 9)) - 😎 as Temperature
RESIDENT A;
Drop Table A;
STORE tmp INTO C:\Users\Mindaugasb\Desktop\VVS\MyCSVFile.csv (txt);
Lets say I will load the same script tomorrow and I need to have two rows of information in csv:
Date Temperature
2015-12-22 7
2015-12-23 5
Any idea would be much appreciated!
short way:
concatenate load (tmp)
load *
from C:\Users\Mindaugasb\Desktop\VVS\MyCSVFile.csv (txt);
short way:
concatenate load (tmp)
load *
from C:\Users\Mindaugasb\Desktop\VVS\MyCSVFile.csv (txt);
I made it by writing:
Drop Table A;
Concatenate (tmp)
LOAD Date,
Temperature
FROM
C:\Users\Mindaugasb\Desktop\VVS\MyCSVFile.txt
(txt, utf8, embedded labels, delimiter is ',', msq);
STORE tmp INTO C:\Users\Mindaugasb\Desktop\VVS\MyCSVFile.txt (txt);