JSon DataSource

Hi! I created a form for protocol/response query, where the data is in a JSON file. I also tested it with Excel, but I can't get it to work when accessed through a browser. It works normally in the preview. Could you help me? Are there any specific file permissions? Code:


async function buscarResposta() {
    const protocoloBuscado = data.txtprotocolo;
    if (!protocoloBuscado) {
        instance.root.getComponent('txtresposta').setValue;
        return;
    }
    const dados = await tf.getDataSource("9999999999999");
    console.log("Dados carregados:", dados);
    const resultado = dados.find(item =>
        String(item?.Protocolo)?.trim() === String(protocoloBuscado).trim()
    );
    if (resultado && resultado.Resposta) {
        instance.setValue("txtresposta", resultado.Resposta);
        instance.root.getComponent('txtresposta').setValue(resultado.Resposta)
    } else {
        instance.root.getComponent('txtresposta').setValue("Não achei");
    }
}
buscarResposta();
screen.png
10.37KB

3 replies