Forum OpenACS Q&A: Bulk upload of categories?

Request notifications

Collapse
Posted by Brian Fenton on
Hi all

I'm looking into doing an import of Categories. I'm just wondering has anyone any experience doing this, or code examples to share? I'm looking at the XML procs in here http://openacs.org/api-doc/procs-file-view?path=packages%2fcategories%2ftcl%2fcategory%2dxml%2dprocs%2etcl and they look pretty good, but it'd be nice to see if anyone has experience importing from CSV or other formats.

thanks
Brian

Collapse
Posted by Dave Bauer on
Seems like its pretty easy to do this by CSV

Something like:

Parent Category | Subcategory

Where you can create an infinite tree of categories based on the name by just looping over the rows in a CSV.

ie: If subcategory is blank create a new top level category. Otherwise create a subcategory of the category with the matching name for parent category.

This assumes you don't have any duplicate categories anywhere in the tree.

Collapse
Posted by Gustaf Neumann on
if you use xowiki, you can let xowiki to the work for you. Make an xowiki::Form, add a form-field using the category tree (e.g. atest:radio,category_tree=audience), make an instance of the form and export it. The export will contain the definitions of the categories and will import the tree on the target machine and remaps the category_ids for this form to the new values.
Collapse
Posted by Brian Fenton on
Thanks for the replies, guys!