TWebDBGrid

Why this dont work ?

  WebClientConnection1.URI := 'http://srvdev01.brazilsouth.cloudapp.azure.com/appserver/emsserver.dll/contatojson';
  WebClientConnection1.DataNode := 'item';
  WebClientDataSet1.FieldDefs.Clear;
  WebClientDataSet1.FieldDefs.Add('referencia',ftString,0);
  WebClientDataSet1.FieldDefs.Add('nome',ftstring,50);
  WebClientDataSet1.FieldDefs.Add('codigo',ftstring,50);

  WebClientConnection1.Active := true;

A TWebDBGrid is clean!!!

Thanks
Josauro S.J.

I cannot test this here, when I try to the URL


http://srvdev01.brazilsouth.cloudapp.azure.com/appserver/emsserver.dll/contatojson

it says:
<strong js="hostName" jstcache="23" style="overflow-wrap: break-word; color: rgb95, 99, 104; font-family: "Segoe UI", Tahoma, sans-serif; font-size: 15px;">srvdev01.brazilsouth.cloudapp.azure.com took too long to respond.</strong>

Hi could you try again, because now it´s working


   http://srvdev01.brazilsouth.cloudapp.azure.com/appserver/emsserver.dll/contatojson



The issue here is that the 'referencia' value is not under data node 'item' but under 'item [ conjuge { } ]'

At this moment, the TWebClientDataSet expects a flat array, not a hierarchical structure like you have under the data node.
Hi
But in my case referencia that I was referencing is not conjuge.referencia but only reference (I have others reference in the json lay-out).

As explained, at this time, the mapping on the dataset expects a flat array under the data node. Try to produce the json this way.

Hi


  Now my json is like above but it doesnt show nothing in webdbgrid


{
    "item": [
        {
            "codigo": 10402400,
            "referencia": "03288.001.02",
            "dataCadastro": "2001-03-15T00:00:00.000Z",
            "nome": "CONVENCAO BATISTA P. DO SUL  BRASIL",
            "dataNascimento": "1899-12-30T00:00:00.000Z",
            "cnpjCpf": "87647277000199",
            "rgNumero": "",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "",
            "sexo": "",
            "ativo": "",
            "estadoCivil": 0,
            "nacionalidade": 9502400,
            "profissao": 8502400,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 10502400,
            "referencia": "09119.001.03",
            "dataCadastro": "2004-02-04T00:00:00.000Z",
            "nome": "WELLINGTON LUIS DE MATOS",
            "dataNascimento": "1967-02-17T00:00:00.000Z",
            "cnpjCpf": "10158356861",
            "rgNumero": "20.607.958",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "SP",
            "sexo": "",
            "ativo": "",
            "estadoCivil": 3702400,
            "nacionalidade": 4102400,
            "profissao": 15102400,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 10702400,
            "referencia": "02400.107",
            "dataCadastro": "2007-02-28T00:00:00.000Z",
            "nome": "LUCY ONO",
            "dataNascimento": "1899-12-30T00:00:00.000Z",
            "cnpjCpf": "00000000000",
            "rgNumero": "",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "",
            "sexo": "",
            "ativo": "S",
            "estadoCivil": 0,
            "nacionalidade": 4102400,
            "profissao": 0,
            "nomeAlternativo": "02590.001",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 10802400,
            "referencia": "09101.001.02",
            "dataCadastro": "2003-09-30T00:00:00.000Z",
            "nome": "HUI LING HUANG",
            "dataNascimento": "1966-10-12T00:00:00.000Z",
            "cnpjCpf": "00546249914",
            "rgNumero": "Y232020 D.",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "P.",
            "sexo": "",
            "ativo": "",
            "estadoCivil": 3602400,
            "nacionalidade": 44902400,
            "profissao": 10202400,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 10902400,
            "referencia": "02700.001.04",
            "dataCadastro": "2004-11-26T00:00:00.000Z",
            "nome": "EZEQUIEL DA SILVA MONTEIRO E/OU",
            "dataNascimento": "1964-07-08T00:00:00.000Z",
            "cnpjCpf": "05116771890",
            "rgNumero": "17.575.620",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "SP",
            "sexo": "M",
            "ativo": "",
            "estadoCivil": 0,
            "nacionalidade": 4102400,
            "profissao": 14802400,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 11002400,
            "referencia": "00458.009.01",
            "dataCadastro": "2006-11-09T00:00:00.000Z",
            "nome": "FERNANDA SAYURI TANAKA",
            "dataNascimento": "1988-03-22T00:00:00.000Z",
            "cnpjCpf": "06125211924",
            "rgNumero": "5.643.598-0",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "PR",
            "sexo": "F",
            "ativo": "",
            "estadoCivil": 3602400,
            "nacionalidade": 4102400,
            "profissao": 22402400,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 3743102400,
            "referencia": "02400.37431",
            "dataCadastro": "2015-12-15T00:00:00.000Z",
            "nome": "ANDERSON CARDOSO RAMOS",
            "dataNascimento": "1899-12-30T00:00:00.000Z",
            "cnpjCpf": "04206484961",
            "rgNumero": "",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "",
            "sexo": "",
            "ativo": "S",
            "estadoCivil": 0,
            "nacionalidade": 4102400,
            "profissao": 0,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 11102400,
            "referencia": "01841.001.01",
            "dataCadastro": "2006-04-27T00:00:00.000Z",
            "nome": "SILVANA MARTINS DOS SANTOS",
            "dataNascimento": "1979-05-04T00:00:00.000Z",
            "cnpjCpf": "02416879936",
            "rgNumero": "5.103.026-8",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "SC",
            "sexo": "F",
            "ativo": "",
            "estadoCivil": 3602400,
            "nacionalidade": 4102400,
            "profissao": 11002400,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 11202400,
            "referencia": "01536.001.04",
            "dataCadastro": "2004-04-05T00:00:00.000Z",
            "nome": "ELIANE FERREIRA",
            "dataNascimento": "1960-12-03T00:00:00.000Z",
            "cnpjCpf": "55336264920",
            "rgNumero": "1.848.617",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "PR",
            "sexo": "F",
            "ativo": "",
            "estadoCivil": 9802400,
            "nacionalidade": 4102400,
            "profissao": 26802400,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        },
        {
            "codigo": 11302400,
            "referencia": "02400.113",
            "dataCadastro": "2007-03-01T00:00:00.000Z",
            "nome": "VISTORIAS DE ENTRADA",
            "dataNascimento": "1899-12-30T00:00:00.000Z",
            "cnpjCpf": "00000000000",
            "rgNumero": "",
            "rgDataExpedicao": "1899-12-30T00:00:00.000Z",
            "rgLocalExpedicao": "",
            "sexo": "",
            "ativo": "S",
            "estadoCivil": 0,
            "nacionalidade": 4102400,
            "profissao": 0,
            "nomeAlternativo": "",
            "filial": 2400,
            "operacao": "opNenhuma"
        }
    ]
}

Do you see data in the WebClientDataSet? Do you get the WebClientDataSet.AfterOpen event trigger? Do you see any error in the browser console?
If a problem persists, please provide an URL to this data so we can test it from here.

The event AfterOpened doesnt is trigger

But I recieve the fields name in WebClienteDataSet (but no data).

The link to acess that is

http://srvdev01.brazilsouth.cloudapp.azure.com/appserver/emsserver.dll/contatojson

I tested this URL from our TWebClientConnection at runtime and I see there is a CORS error.
So, please enable CORS on your server and this should work.


See: https://www.tmssoftware.com/site/tmswebcore.asp?s=faq&show=963

Hi I Add in response headers  (RadServer)


        AResponse.Headers.SetValue('Access-Control-Allow-Headers', 'Content-Type, Authorization');
        AResponse.Headers.SetValue('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');


And its work fine.

thanks.

Great! Thanks for confirming.