SitesMasstec
Programmer
Hello colleagues!
I have, at last, been using CURSOR, thank you.
In the small program bellow I send a request to an API provider:
The result is:
This is Ok.
Then, I created a Cursor to populate with data read from API, that is, I want to "consume" the data:
But I have not got any result to my_bairro and my_cidade ...
It seems something wrong with STREXTRACT parameters I had informed.
Thank you,
SitesMasstec
I have, at last, been using CURSOR, thank you.
In the small program bellow I send a request to an API provider:
Code:
xmlHttp = CREATEOBJECT("MSXML2.ServerXMLHTTP")
* xmlHttp.open("GET", "[URL unfurl="true"]https://api.postmon.com.br/v1/cep/13041-620",[/URL] null)
* Substitituído pelas 3 linhas abaixo:
myCEP="33236-434" && Value (in the real program it will be a variable)
CEPparaAPI="[URL unfurl="true"]https://api.postmon.com.br/v1/cep/"+myCEP[/URL]
xmlHttp.open("GET", CEPparaAPI, null)
xmlHttp.setRequestHeader("Content-Type", "text/xml")
xmlHttp.send("")
result = xmlHttp.responseText
? result
The result is:
This is Ok.
Then, I created a Cursor to populate with data read from API, that is, I want to "consume" the data:
Code:
CREATE CURSOR my_Endereco;
( my_bairro c(22),;
my_cidade c(20),;
my_logradouro c(34),;
my_estado c(2) )
my_bairro = STREXTRACT( result, ["bairro": ], [,] )
my_cidade = STREXTRACT( result, ["cidade": ], [,] )
* etc etc
? my_bairro
? my_cidade
* Comands to populate the Cursor will be here
But I have not got any result to my_bairro and my_cidade ...
It seems something wrong with STREXTRACT parameters I had informed.
Thank you,
SitesMasstec