# Javascript en Velneo V7

**URL:** <https://foros.velneo.com/t/javascript-en-velneo-v7/5305>\
**Category:** Velneo\
**Created:** [5 Julio, 2012 08:02 UTC](https://foros.velneo.com/t/javascript-en-velneo-v7/5305 "2012-07-05T08:02:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![filipeagg](https://yyz1.discourse-cdn.com/flex035/user_avatar/foros.velneo.com/filipeagg/32/3954_2.png) [@filipeagg](https://foros.velneo.com/u/filipeagg)\
**Post date:** [5 Julio, 2012 08:02 UTC](https://foros.velneo.com/t/javascript-en-velneo-v7/5305/1 "2012-07-05T08:02:44Z")

</div>

He estado probando un poco más a fundo javascript en v7, y he echo el seguiente proceso:

`var table_name = theRoot.varToString( "TABLE_NAME" ); var theMainProject = theApp.mainProjectInfo(); if ( theMainProject ) { for( var nIndex=0; nIndex &lt; theMainProject.allTableCount(); nIndex++ ) { var tableInfo = theMainProject.allTableInfo( nIndex ); if ( tableInfo ) { if (tableInfo.id() == table_name) {break;} } } } theRoot.setVar( "TABLE_ID", ''+nIndex );`

La pregunta es, existe forma de obtener el identificador numerico de la tabla usando su identificador alfabetico, sin tener que recorrer todas las tablas del proyecto?

O sea que le pasemos el nombre(identificador) de la tabla y nos devuelva el id numerico de las misma?

[http://filipegomes.eu](http://filipegomes.eu)

---

<div class="post-metadata">

**Author:** ![neocursar](https://avatars.discourse-cdn.com/v4/letter/n/7bcc69/32.png) [@neocursar](https://foros.velneo.com/u/neocursar)\
**Post date:** [5 Julio, 2012 09:43 UTC](https://foros.velneo.com/t/javascript-en-velneo-v7/5305/2 "2012-07-05T09:43:17Z")

</div>

Si.  
Enviando una variable con el handle de la tabla.

var aplicacion = theApp.mainProjectInfo();  
var tablaNum = theRoot.varToInt( “HANDLE” );  
theRoot.setVar(“TBL\_ID”, aplicacion.allTableInfo( tablaNum ).id());  
theRoot.setVar(“TBL\_NAME”, aplicacion.allTableInfo( tablaNum ).name());

Yo tengo esto en los eventos de tabla y funciona correcto.
