cancel
Showing results for 
Search instead for 
Did you mean: 

How to populate attribute picklist with data from a database

alexr
Champ in-the-making
Champ in-the-making
I managed to create a custom doctype with custom attributes/contstraints.
However each attribute picklist is a "fixed" list entered manually.

Are there any services or common ways to populate the attributes picklists from an external database (business data).

For example. Suppose in the company we have a "customers" database in which customer names/shortnames are maintained.


If I have a custom document and one attribute is "customer name" or "customer shortname". Can anyone tell me the best practice to implement a dynamic update of this attribute from the external database with customer data?

Is there a way to configure this in Alfresco?
Smiley Happy
6 REPLIES 6

roman
Champ in-the-making
Champ in-the-making
I don't know if i can help you,

I'm new to alfresco too…but i had the same requirements.
Check out this:
http://wiki.alfresco.com/wiki/Constraints

hope this helps…

best regards

alexr
Champ in-the-making
Champ in-the-making
Hi Roman,

Thank you for pointing me to the constraints wiki page. However this
does not describe how to populate properties via automatically via an external external reference (database field). The constraints referenced in
the examples are a manually filled xml-file with constraints.

In other words (not using the terms). I got a Newdocument type with
a custom property Customername. I don't want this to point to a restrictive
xml contraint list. This property needs to be populated with the values of a
database field/column Customer from our customer relations database for example (i.e. Oracle). How can this be automated? Is this a setting/option
for properties? or for constraints?

Kind regards,

Alex

roman
Champ in-the-making
Champ in-the-making
I don't know exactly what you mean, but you don't have to fill the values over the xml file.
you can write your own constraint class which fills the values from database, etc.

http://wiki.alfresco.com/wiki/Constraints#Writing_Further_Constraints

you define a constraint with the type of your own constraint.

in this class you can override the setAllowedValues function and populate your own values.

I'm working at nearly the same problem at the moment. i can populate a combobox with my own values but i want to have more information in the select-option tag (especially the value attribute should get my defined value)
so in this case you got to write own component generator and perhaps an own jsf component.
I'm at it at the moment, don't know if i'm right.

so hopes this helps

regards

alexr
Champ in-the-making
Champ in-the-making
Hi Roman,

Sounds logical. Could you let me know when you have
some code that works and send me an example. It would
really help.

Thank you very much.

Kind Regards,

Alex

marcostopper
Champ in-the-making
Champ in-the-making
I also need to populate a combobox with value from a database.
Can you send me an exmple to understand:
how modify the custom property to have a combobox;
how the combobox can get values froma database.

Thank you a lot,
Here is may e-mail address:

marcostopper@libero.it

venzia
Star Collaborator
Star Collaborator
Hi guys!, I guess I get a little outdated, but to complete this post, for those arriving now, I would like to mention that there is a component in Alfresco Addons that does this and more in a simple, intuitive and powerful way.
https://addons.alfresco.com/addons/alfresco-metadbconnector-component
I hope this helps the community.

Greetings!