Will do thanks. 


-------- Original message --------
From: "Riccardo (Jack) Lucchetti"
Date:04/22/2014 2:46 AM (GMT-06:00)
To: Logan Kelly
Cc: Gretl development
Subject: RE: [Gretl-devel] New function for retrieving data from BLS

On Mon, 21 Apr 2014, Logan Kelly wrote:

> Jack,
>
> Probably could do with string manipulation. I will have a thought about
> it. The code might get a bit ugly and it might not be the fastest ever,
> but the real time consumer will be the HTTP post request.

True. Having seen what BLS returns from a typical query, I'd suggest you
to proceed as follows:

* load the output from bls.gov as a huge ascii string;
* by using native functions (readfile, getline, sscanf spring to mind),
write an intermediate text file with the structure

code, period, value
...
CFU0000008000, 2000, 5920
CFU0000008000, 2002, 5534
...

Note that the ordering of the rows will be irrelevant (apart, of course,
from the header line)

* use the "join" command to import the data into your dataset

I agree, it won't be pretty, but it should do the job.

> Question about readfile? Can you make an HTTP post request? Can you
> specify a payload?

Not at the moment, no, we have no native equivalent to the "curl" command.
However, that's available for all major OSes, so you might as well issue a
system call via "!" (see the help for the "shell" command) for now.


-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   UniversitÓ Politecnica delle Marche
   (formerly known as UniversitÓ di Ancona)

   r.lucchetti@univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------