WebService Dataset FLUIG

0

I'm trying to implement a FLUIG (TOTVS) dataSet that requests an external ws to render a table in a wigdet, however when I perform or interact with Dataset object to get the data in the widget can not access. It's okay.

   var dataset  = DatasetBuilder.newDataset();
    var dtInicio = constraints[1].initialValue;
    var dtFim    = constraints[1].initialValue; 
    var regional = constraints[2].initialValue;
    var clientService = fluigAPI.getAuthorizeClientService();

     var data = {                                                   
            companyId : getValue("WKCompany") + '',
            serviceCode : 'sigo',                     
            endpoint : '/sigo/adm/lms/buscarDadosGedGestao/',  
            method : 'post',                                  
            timeoutService: '180', 
            params : {                                             
                    dtInicio   :  dtInicio +'',
                    dtFim      :  dtFim +'',
                    regional   : regional + ''                                    
            }                                                      
        }                                                          

        var v = clientService.invoke(JSON.stringify(data));
        log.info('dsbuscarDadosGedGestao15 - Retorno WebService: ' + v.getResult());

        if(v.getResult() == null || v.getResult().isEmpty()){
        }else{

                var dados = JSON.parse(v.getResult());
                if(dados instanceof  Array){

                dataset.addColumn("chapa");
                dataset.addColumn("nome");
                dataset.addColumn("cargo");
                dataset.addColumn("idFilial");
                dataset.addColumn("filial");
                dataset.addColumn("dtNascimento");
                dataset.addColumn("dtAdmissao");
                dataset.addColumn("rua");
                dataset.addColumn("numero");
                dataset.addColumn("bairro");
                dataset.addColumn("cidade");
                dataset.addColumn("uf");
                dataset.addColumn("idDocumento");
                dataset.addColumn("descricao");

                for(var i = 0; i < dados.length; i++){

                    dataset.addRow(new Array(dados[i].chapa,
                                             dados[i].nome,
                                             dados[i].cargo,
                                             dados[i].idFilial,
                                             dados[i].filial,
                                             dados[i].dtNascimento,
                                             dados[i].dtAdmissao,
                                             dados[i].rua,
                                             dados[i].numero,
                                             dados[i].bairro,
                                             dados[i].cidade,
                                             dados[i].uf,
                                             dados[i].idDocumento,
                                             dados[i].descricao));

                }
            }

          }
  return dataset;

➟ Widget (Where I will interact with DataSet data

   dsbuscarDadosGedGestao =  DatasetFactory.getDataset('dsbuscarDadosGedGestao', null, parametros, null); 
 if(dsbuscarDadosGedGestao.values.length >0){
        console.log('Dentro da Função');
        var obj = new Object();

        obj.chapa = dsbuscarDadosGedGestao.values[i]['chapa'];
        console.log("Chapa "+ obj.chapa[0]);
    } 
    
asked by anonymous 18.12.2018 / 20:10

0 answers