<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[My Visual Database — Brazilian find postcode need help]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=8461</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=8461&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Brazilian find postcode need help.]]></description>
		<lastBuildDate>Thu, 23 Mar 2023 07:31:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Brazilian find postcode need help]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=47092#p47092</link>
			<description><![CDATA[<p>Hi Jean,</p><p>No, that won&#039;t work.<br />TryStrToInt is a function that tries to convert a string to an integer and returns the result. True or False .<br />But this function is not supported in MVD.<br />ValidInt() can be used. Or rewrite the procedure a bit. But as I understand it, this is only a small part of what they are trying to adapt.</p><br /><p>amsjunior1 can be advised to start reading the Delphi and MVD documentation.</p>]]></description>
			<author><![CDATA[null@example.com (sparrow)]]></author>
			<pubDate>Thu, 23 Mar 2023 07:31:14 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=47092#p47092</guid>
		</item>
		<item>
			<title><![CDATA[Re: Brazilian find postcode need help]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=47091#p47091</link>
			<description><![CDATA[<p>Hello amsjunior1<br />Put an space between Try and StrToInt or better<br />Try<br />StrToInt(xxx)</p><p>JB</p>]]></description>
			<author><![CDATA[null@example.com (jean.brezhonek)]]></author>
			<pubDate>Thu, 23 Mar 2023 07:12:34 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=47091#p47091</guid>
		</item>
		<item>
			<title><![CDATA[Re: Brazilian find postcode need help]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=47089#p47089</link>
			<description><![CDATA[<p>undeclared indentifier TryStrToInt<br />sorry another error now.</p><div class="codebox"><pre><code>procedure Clientes_Button1_OnClick(Sender: TObject; var Cancel: boolean);
var
  Logradouro, Bairro, Cidade, UF: string;
  CEP: string;
  CEPInt: integer;
begin
  // lê o valor da caixa de texto do CEP
  CEP := Clientes.edCEP.Text;

  // verifica se o valor digitado é um CEP válido
  if (Length(CEP) &lt;&gt; 8) or (not TryStrToInt(CEP, CEPInt)) then
  begin
    ShowMessage(&#039;CEP inválido!&#039;);
    Exit; // interrompe a execução da função
  end;

  // executa a consulta com o CEP digitado
  ConsultarCEP(IntToStr(CEPInt), Logradouro, Bairro, Cidade, UF);

  // atribui os valores retornados às caixas de texto
  Clientes.edLogradouro.Text := Logradouro;
  Clientes.edBairro.Text := Bairro;
  Clientes.edCidade.Text := Cidade;
  Clientes.edUF.Text := UF;
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (amsjunior1)]]></author>
			<pubDate>Wed, 22 Mar 2023 23:12:50 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=47089#p47089</guid>
		</item>
		<item>
			<title><![CDATA[Re: Brazilian find postcode need help]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=47088#p47088</link>
			<description><![CDATA[<p>should be<br /><strong>FormName.ComponentName.Text</strong></p>]]></description>
			<author><![CDATA[null@example.com (sparrow)]]></author>
			<pubDate>Wed, 22 Mar 2023 07:25:00 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=47088#p47088</guid>
		</item>
		<item>
			<title><![CDATA[Re: Brazilian find postcode need help]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=47085#p47085</link>
			<description><![CDATA[<div class="codebox"><pre><code>procedure Clientes_Button1_OnClick(Sender: TObject; var Cancel: boolean);
var
  Logradouro, Bairro, Cidade, UF: string;
  CEP: string;
begin
  // lê o valor da caixa de texto do CEP
  CEP := edCEP.Text;

  // verifica se o valor digitado é um CEP válido
  if (Length(CEP) &lt;&gt; 8) or (not TryStrToInt(CEP, CEP)) then
  begin
    ShowMessage(&#039;CEP inválido!&#039;);
    Exit; // interrompe a execução da função
  end;

  // executa a consulta com o CEP digitado
  ConsultarCEP(CEP, Logradouro, Bairro, Cidade, UF);

  // atribui os valores retornados às caixas de texto
  edLogradouro.Text := Logradouro;
  edBairro.Text := Bairro;
  edCidade.Text := Cidade;
  edUF.Text := UF;
end;</code></pre></div><p>undeclared indentifier edCEP</p><p>thanks for code, but now another error.</p>]]></description>
			<author><![CDATA[null@example.com (amsjunior1)]]></author>
			<pubDate>Wed, 22 Mar 2023 00:31:31 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=47085#p47085</guid>
		</item>
		<item>
			<title><![CDATA[Re: Brazilian find postcode need help]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=47055#p47055</link>
			<description><![CDATA[<div class="codebox"><pre><code>procedure ConsultarCEP(vCEP: string; var vLogradouro, vBairro, vCidade, vUF: string);
var s :variant;
begin
try
 s:=CreateOleObject(&#039;ScriptControl&#039;);
 s.Language := &#039;JavaScript&#039;;
 s := s.Eval(&#039;(&#039;+HttpGET( &#039;https://viacep.com.br/ws/&#039;+vCEP+&#039;/json/&#039;)+&#039;)&#039;);
 try
    vLogradouro := s.logradouro;
    vBairro := s.bairro;
    vCidade := s.localidade;
    vUF := s.uf;
 except
     if (s.erro) = &#039;true&#039; then
     ShowMessage(&#039;Not found: &quot;&#039;+vCEP+&#039;&quot;&#039;);
 end;
 finally
   s:=0;
 end;

end;

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var Logradouro, Bairro,  Cidade, UF:string;
begin
  ConsultarCEP(&#039;01001000&#039;,Logradouro,Bairro,Cidade,UF);
  ShowMessage(Logradouro +#13#10+ Bairro +#13#10+ Cidade +#13#10+ UF);
end;   </code></pre></div><p>Дальше сам...</p>]]></description>
			<author><![CDATA[null@example.com (vovka3003)]]></author>
			<pubDate>Sun, 19 Mar 2023 21:26:14 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=47055#p47055</guid>
		</item>
		<item>
			<title><![CDATA[Re: Brazilian find postcode need help]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=47042#p47042</link>
			<description><![CDATA[<p>Some classes and functions are not supported in MVD.</p>]]></description>
			<author><![CDATA[null@example.com (sparrow)]]></author>
			<pubDate>Sun, 19 Mar 2023 07:58:08 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=47042#p47042</guid>
		</item>
		<item>
			<title><![CDATA[Brazilian find postcode need help]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=47041#p47041</link>
			<description><![CDATA[<p>procedure ConsultarCEP(vCEP: string; var vLogradouro, vBairro, vCidade, vUF: string);<br />var<br />&nbsp; vHTTP: TIdHTTP;<br />&nbsp; vXML: TStringStream;<br />&nbsp; vXMLDoc: TXMLDocument;<br />&nbsp; vCEPNode, vLogradouroNode, vBairroNode, vCidadeNode, vUFNode: IXMLNode;<br />begin<br />&nbsp; vHTTP := TIdHTTP.Create(nil);<br />&nbsp; vXML := TStringStream.Create(&#039;&#039;);<br />&nbsp; try<br />&nbsp; &nbsp; vHTTP.Get(&#039;https://viacep.com.br/ws/&#039; + vCEP + &#039;/xml/&#039;, vXML);<br />&nbsp; &nbsp; vXML.Position := 0;<br />&nbsp; &nbsp; ReadXMLFile(vXMLDoc, vXML);<br />&nbsp; &nbsp; vCEPNode := vXMLDoc.ChildNodes.FindNode(&#039;xmlcep&#039;);<br />&nbsp; &nbsp; if Assigned(vCEPNode) then<br />&nbsp; &nbsp; begin<br />&nbsp; &nbsp; &nbsp; vLogradouroNode := vCEPNode.ChildNodes.FindNode(&#039;logradouro&#039;);<br />&nbsp; &nbsp; &nbsp; vBairroNode := vCEPNode.ChildNodes.FindNode(&#039;bairro&#039;);<br />&nbsp; &nbsp; &nbsp; vCidadeNode := vCEPNode.ChildNodes.FindNode(&#039;localidade&#039;);<br />&nbsp; &nbsp; &nbsp; vUFNode := vCEPNode.ChildNodes.FindNode(&#039;uf&#039;);<br />&nbsp; &nbsp; &nbsp; if Assigned(vLogradouroNode) then<br />&nbsp; &nbsp; &nbsp; &nbsp; vLogradouro := vLogradouroNode.Text;<br />&nbsp; &nbsp; &nbsp; if Assigned(vBairroNode) then<br />&nbsp; &nbsp; &nbsp; &nbsp; vBairro := vBairroNode.Text;<br />&nbsp; &nbsp; &nbsp; if Assigned(vCidadeNode) then<br />&nbsp; &nbsp; &nbsp; &nbsp; vCidade := vCidadeNode.Text;<br />&nbsp; &nbsp; &nbsp; if Assigned(vUFNode) then<br />&nbsp; &nbsp; &nbsp; &nbsp; vUF := vUFNode.Text;<br />&nbsp; &nbsp; end;<br />&nbsp; finally<br />&nbsp; &nbsp; vHTTP.Free;<br />&nbsp; &nbsp; vXML.Free;<br />&nbsp; &nbsp; vXMLDoc.Free;<br />&nbsp; end;<br />end;</p><br /><p>this code is correct? im try but is some error.</p>]]></description>
			<author><![CDATA[null@example.com (amsjunior1)]]></author>
			<pubDate>Sat, 18 Mar 2023 23:29:00 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=47041#p47041</guid>
		</item>
	</channel>
</rss>
