Are you saying the CSV files contain string values rather than the integer 
record IDs in each reference field (e.g., an entry in PL.BL_name is 
actually a value from the "name" field of BL rather than the integer record 
ID from BL)? If that is the case, I don't think the built-in import methods 
will work -- you'll probably have to write your own code to handle it.

Anthony

On Thursday, January 5, 2017 at 11:18:42 PM UTC-5, Adam Jed wrote:
>
> Hi,
>
> I have defined tables: 
>
> db.define_table('BL',
>                 Field('name'),
>                 format='%(name)s'
>                 )
>
> db.define_table('PL',
>                 Field('name'),
>                 Field('BL_name', 'reference BL'),
>                 format='%(name)s'
>                 )
>
> db.define_table('PRO',
>                 Field('name'),
>                 Field('BL_name', 'reference BL'),
>                 Field('PL_name', 'reference PL'),
>                 format='%(name)s'
>                 )
>
> db.define_table('ALL',
>                 Field('PRO','reference PRO'),
>                 Field('PL','reference PL'),
>                 Field('BL','reference BL')
>                 )
>
> Now i want to import csv into ALL table with:
> import_from_csv_file(file,delimiter=",",id_map={})
>
> I'm receiving error: 
> <type 'exceptions.ValueError'> invalid literal for long() with base 10: 
> "the cell value of the filed here"
> It works only when I provide the referenced fields ID's into csv file. 
> I would like to import the csv with the string values that are defined in 
> the BL,PL,PRO tables.
>
> Any ideas how to make the import_from_csv_file accepts the "name" fields 
> from the tables instead of id's ?
>

-- 
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