Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

327
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda