Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

113
Visualizações
object split in two parts

i have an object that's have to be split in two parts cause the information that I grab from an excel is a jumbles mess, so I made this :

const data4 = xmlOrdenEntrega(salida4);

let dataPlanilla = [];

let order = {
    cabecera: {},
    detalle: [],
};

let esDetalle = false;

let detalle = {
    item: null,
    itemStatus: null,
    qtyOrd: null,
    qtyShp: null,
    description: null,
    series: null,
    color: null,
    uom: null,
    qtyPerBox: null,
    amount: null,
    currency: null,
    cubes: null,
    estLoadDate: null,
}

let esCabecera = false;
let cabecera = {
    store: null,
    order: null,
    po: null,
    mode: null,
    ordDte: null,
    reqDte: null,
    status: null,
    whse: null,
};

let esPrimerciclo = true
data4.forEach(datito => {
    if (datito.__EMPTY == 'Store #:') {
        if (!esPrimerciclo) {
            dataPlanilla.push(order);
            esPrimerciclo = false;
        }
        esDetalle = false;
        esCabecera = true;
        cabecera = {
            store: datito.__EMPTY_1,
            order: datito.__EMPTY_3,
            po: datito.__EMPTY_5,
            mode: datito.__EMPTY_7,
        };
        order.cabecera = cabecera;
    }

    if (esCabecera == true && datito.__EMPTY != 'Store #:') {
        cabecera = {
            ordDte: datito.__EMPTY_1,
            reqDte: datito.__EMPTY_3,
            status: datito.__EMPTY_5,
            whse: datito.__EMPTY_7,
        }
        order.cabecera = cabecera;
        esCabecera = false;
    }

in theory the object should be completed at the moment that it is saved to Order, but right now I'm not getting the completed object. i only receive half of it. if someone knows how to resolve this problem I would be thankful.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda