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

331
Visualizações
Forge Viewer: getExternalIdMapping() to return only certain dbIds from certain externalIds
this.viewer.model.getExternalIdMapping(data => console.log(data))

This particular line gets everything. But I only need the dbIds of certain externalIds. How can I do that?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

A few ways depending on what exactly you need. Here's what I've done.

function getDbIdFromExternalId(externalIds) {
    return new Promise((resolve) => {
      viewer.model.getExternalIdMapping((d) => {
        //console.log("getDbIdFromExternalId Executed");
        let responseArr = [];
        externalIds.forEach(externalId => {
            if(d[externalId]) responseArr.push([d[externalId], externalId]);
        });
        resolve(responseArr);
      });
    });
}
/*Your external IDs in here*/
var externalIds = ['23287','23292','23291'];
/*response is set here*/
var response = await getDbIdFromExternalId(externalIds);

Expected value of response (with my autocad viewer): [[39675,"23292"],[39674,"23291"]]

That way you can see the pair. Notice I threw in a value that didn't map to anything, so the array was only populated with what it found.

about 4 years ago · Juan Pablo Isaza Relatório

0

Another option would be to implement your own user function and calling the getExternalIdMapping method of the property database that can actually be filtered for specific external IDs:

function mapMyExternalIds(model, externalIds) {
  const filter = {};
  for (const externalId of externalIds) {
    filter[externalId] = true;
  }
  return model.getPropertyDb().executeUserFunction(function userFunction(pdb, filter) {
    return pdb.getExternalIdMapping(filter);
  }, filter);
}

Then you can use it like so:

mapMyExternalIds(NOP_VIEWER.model, ["6949fe39-3e9a-4d4d-b7fe-71339c615138-00022318"])
  .then(map => console.log(map))
  .catch(err => console.error(err));
about 4 years ago · Juan Pablo Isaza Relatório
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