can we use table aliases in scripts files

  • 0
  • 2
  • Question
  • Updated 1 year ago
  • Answered

My application uses lots of jquery script files and the TABLE ID is hard coded everywhere.

The problem is that these IDs changes when the application is either copied or a new sandbox environment is created and the IDs have to be changed in all the scripts.

Is there a way to use the DB aliases in the script file or many be a better approach to handle this?, I tried using the DB aliases but that didn't work.

Photo of Tribs


  • 20 Points

Posted 3 years ago

  • 0
  • 2
Photo of Chuck Grigsby

Chuck Grigsby

  • 2,100 Points 2k badge 2x thumb
You should be able to use _DBID_TABLENAME but I could be wrong about that. I definitely know that gDBID is global variable for the table ID your on. Hope that helps.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
You can't use table aliases in scripts. 

However you can determine the mapping between table aliases and dbids using the API.

Call dbid?act=API_GetSchema on the application dbid and the names and dbid's of each table will be listed within the <chdbids> tag.

See also:

How is the name of a table alias determined ?
Photo of David Maskasky

David Maskasky

  • 160 Points 100 badge 2x thumb
Oh I just posted on this.  Yes you can as long as you have the app dbid.