What do you mean by "external database"? Are you actually meaning a legacy 
database that the DAL didn't create itself? You can certainly connect 
web2py to such a database through the DAL or even just using 
db.executesql().

If you need to get a list of valid options for your combobox you can do 
something like this.

choices = db.executesql("SELECT name_field, id_field FROM sometable WHERE 
foo = ? ORDER BY name_field", (foo_value), as_dict = True)

choice_options = [OPTION(c['name_field'], c['id_field']) for c in choices]
valid_options = (c['id_field'] for c in choices)

#then while you're creating a FORM()
SELECT(*choice_options, **dict(_name="my_field", requires = IS_IN_SET(
valid_options))





On Wednesday, September 17, 2014 2:39:37 PM UTC-5, José Eloy wrote:
>
> Hello!
>
> I need to populate a combobox in a FORM (or SQL FORM) with the content of 
> a field of a table which is in an external SQL Server database. I know that 
> is not possible to reference an external database using DAL, but how can I 
> to load the content of the external field in a SQLFORM field (combobox)?
>
> Any idea?
>
> Regards.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to