[web2py] convert a string to a table or field?

2010-12-01 Thread Lorin Rivers
I tried making a generic function that created a table variable by concatenating strings. myTable = tableBuilder('inverter',period=5) def tableBuilder(element,period=0): if element == 'inverter': if period = 0: return 'db4.' + 'arraydata_table' elif period = 1: return

Re: [web2py] convert a string to a table or field?

2010-12-01 Thread Branko Vukelic
On Thu, Dec 2, 2010 at 1:11 AM, Lorin Rivers lriv...@mosasaur.com wrote: I tried making a generic function that created a table variable by concatenating strings. myTable = tableBuilder('inverter',period=5) def tableBuilder(element,period=0):  if element == 'inverter':    if period = 0:

Re: [web2py] convert a string to a table or field?

2010-12-01 Thread Branko Vukelic
On Thu, Dec 2, 2010 at 1:11 AM, Lorin Rivers lriv...@mosasaur.com wrote: I tried making a generic function that created a table variable by concatenating strings. myTable = tableBuilder('inverter',period=5) def tableBuilder(element,period=0):  if element == 'inverter':    if period = 0:  

Re: [web2py] convert a string to a table or field?

2010-12-01 Thread Stef Mientki
On 02-12-2010 01:11, Lorin Rivers wrote: I tried making a generic function that created a table variable by concatenating strings. myTable = tableBuilder('inverter',period=5) def tableBuilder(element,period=0): if element == 'inverter': if period = 0: return 'db4.' +

Re: [web2py] convert a string to a table or field?

2010-12-01 Thread Branko Vukelic
On Thu, Dec 2, 2010 at 1:23 AM, Stef Mientki stef.mien...@gmail.com wrote: that doesn't return a table variable, but a string, so maybe you want  return eval ( 'db4' + 'arraydata_table') Don't use eval. It's evil! :) 'db4' doesn't have to be a string. I think you can access the tables using