function createDataset(fields, constraints, sortFields) {
    var dataset = DatasetBuilder.newDataset();

    dataset.addColumn("C8_FILIAL");
    dataset.addColumn("C8_NUM");
    dataset.addColumn("C8_ITEM");
    dataset.addColumn("C8_PRODUTO");
    dataset.addColumn("C8_QUANT");
    dataset.addColumn("C8_PRECO");
    dataset.addColumn("C8_TOTAL");
    dataset.addColumn("C8_DATPRF");
    dataset.addColumn("C8_EMISSAO");
    dataset.addColumn("C8_NUMSC");
    dataset.addColumn("B1_DESC");
    dataset.addColumn("B1_UM");
    dataset.addColumn("B1_TIPO");

    try {
        var numeroCot = null;
        if (constraints) {
            for (var i = 0; i < constraints.length; i++) {
                if (constraints[i].fieldName == "numCotacao") {
                	numeroCot = constraints[i].initialValue;
                }
            }
        }

        var clientService = fluigAPI.getAuthorizeClientService();
        var data = {
            companyId: "1",
            serviceCode: "Postprod",
            endpoint: "/rest/uf_mata131", // sem número -> ele retorna todos
            method: "get",
            timeoutService: "60000"
        };

        var vo = clientService.invoke(JSON.stringify(data));
        if (vo && vo.getResult()) {
            var objData = JSON.parse(vo.getResult());
            var itens = objData["solicitacoes"];

            if (itens && itens.length > 0) {
                for (var i = 0; i < itens.length; i++) {
                    var item = itens[i];

                    // 🔎 se veio constraint, filtra pelo C8_NUM
                    if (numeroCot && item["C8_NUM"] != numeroCot) {
                        continue;
                    }

                    dataset.addRow([
                        item["C8_FILIAL"] || "",
                        item["C8_NUM"] || "",
                        item["C8_ITEM"] || "",
                        item["C8_PRODUTO"] || "",
                        item["C8_QUANT"] || "",
                        item["C8_PRECO"] || "",
                        item["C8_TOTAL"] || "",
                        item["C8_DATPRF"] || "",
                        item["C8_EMISSAO"] || "",
                        item["C8_NUMSC"] || "",
                        item["B1_DESC"] || "",
                        item["B1_UM"] || "",
                        item["B1_TIPO"] || ""
                    ]);
                }
            }
        }
    } catch (e) {
        dataset.addRow(["Erro: " + e.message]);
    }

    return dataset;
}
