Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Load only new rows to csv

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!

1 Solution

Accepted Solutions
Anonymous
Not applicable

short way:

  1. tmp: 
  2. LOAD DISTINCT 
  3.   Today() as Date 
  4.   ,Right(Left(Pick(51 $(vExA) ), len(Pick(51 $(vExA) )) - 9), len(left(Pick(51 $(vExA) ), len(Pick(51 $(vExA) )) - 9)) - 😎 as Temperature 
  5. RESIDENT A; 

concatenate load (tmp)

load *

from C:\Users\Mindaugasb\Desktop\VVS\MyCSVFile.csv (txt); 

View solution in original post

2 Replies
Anonymous
Not applicable

short way:

  1. tmp: 
  2. LOAD DISTINCT 
  3.   Today() as Date 
  4.   ,Right(Left(Pick(51 $(vExA) ), len(Pick(51 $(vExA) )) - 9), len(left(Pick(51 $(vExA) ), len(Pick(51 $(vExA) )) - 9)) - 😎 as Temperature 
  5. RESIDENT A; 

concatenate load (tmp)

load *

from C:\Users\Mindaugasb\Desktop\VVS\MyCSVFile.csv (txt); 

MindaugasBacius
Partner - Specialist III
Partner - Specialist III
Author

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);