cancel
Showing results for 
Search instead for 
Did you mean: 

Templates and MySQL

tiofelix
Champ in-the-making
Champ in-the-making
Hi,

   In the Alfresco database there is a table called node where all new documents created are stored. In this table there is a column called "id" and another one called "uuid". If i try to show the "id" of a document from a template (editing doc_info.ftl: ${document.id}) only appears the "uuid" and i want to show the 'id' of the document… how can i do??

   Thanks.
6 REPLIES 6

kevinr
Star Contributor
Star Contributor
the property is called 'dbid'

Thanks,

Kevin

tiofelix
Champ in-the-making
Champ in-the-making
Sorry, but i 've just do it and doesn`t work.

   I've put exactly in 'doc_info.ftl' :

           
 <b>id:</b> ${document.dbid}<br>

   The error is:

              'Expression document.dbid is undefined on line 7, column 17 in workspace://SpacesStore/4a4c9334-1ca7-11db-a32d-111a2d374a80.'

kevinr
Star Contributor
Star Contributor
Sorry you need to access it from the properties Map, and it's part of the sys namespace:
<b>id:</b> ${document.properties["sys:node-dbid"]}<br>

Thanks,

Kevin

tiofelix
Champ in-the-making
Champ in-the-making
Thanks Kevin, now it works.Smiley Very Happy

tiofelix
Champ in-the-making
Champ in-the-making
Hi,
  
     I thought about the 'dbid' as a sequential code number(1,2,3,…) for each new document but i've just realized that 'dbid' increments too when a new space is created, is there any other field(id, dbid,..) that can i use for my requirements??

     Thanks.

kevinr
Star Contributor
Star Contributor
The dbid field is the row index into the node table, so yes it will increment when any new node is added by any user. It is useful as it is guaranteed to be unique within a single store (but of course only the GUID is unique across all stores and repositories).

I'm not sure if there is a value like you need…

Thanks,

Kevin