| 10 | |
| 11 | === Open Office === |
| 12 | Can import data from spreadsheets in .fods format (e.g. created by Open Office). |
| 13 | |
| 14 | This is best as it handles complex resources. |
| 15 | |
| 16 | via web: |
| 17 | * http://myhost.com/eden/hms/hospital/create.fods?filename=myhospitals.fods |
| 18 | |
| 19 | or from Web2Py CLI: |
| 20 | {{{ |
| 21 | resource = s3xrc.resource("hms", "hospital") |
| 22 | template = os.path.join(request.folder, resource.XSLT_PATH, "fods", "import.xsl") |
| 23 | resource.import_xml("myhospitals.fods", template=template) |
| 24 | }}} |
| 25 | |
| 26 | Structure of the file should be as follows: |
| 27 | * Sheet name = resource name |
| 28 | * First row = attribute/field names |
| 29 | * Other rows = attribute/field values |
| 30 | |
| 31 | ==== References ==== |
| 32 | 1. Insert another sheet with the entries of the referenced table, this sheet must have the same name as the referenced table and a column "uuid" |
| 33 | 2. Insert a column in the main sheet with a column title like: |
| 34 | {{{ |
| 35 | reference:<fieldname>:<referenced_table> |
| 36 | }}} |
| 37 | e.g. "reference:organisation_id:org_organisation" |
| 38 | 3. fill in this column with the UUIDs of the respective entries |
| 39 | in the referenced table |
| 40 | |
| 41 | ==== Components: ==== |
| 42 | 1. Insert another sheet with the entries of the component table, this sheet must have a name like: |
| 43 | {{{ |
| 44 | <main-table-name>+<component-table-name> |
| 45 | }}} |
| 46 | e.g. "hms_hospital+hms_hactivity" |
| 47 | 2. Insert a column into the component sheet with a name like: |
| 48 | {{{ |
| 49 | <main-table-name>.<key-field> |
| 50 | }}} |
| 51 | e.g. "hms_hospital.gov_uuid"[[BR]] |
| 52 | => the key field must be present in the main table[[BR]] |
| 53 | => the key field must be unique (primary key) in the main table[[BR]] |
| 54 | 3. Fill in this column with the respective values of the key field in the parent entry of the main table |
| 55 | |
24 | | |
25 | | === Open Office === |
26 | | Can import data from spreadsheets in .fods format (e.g. created by Open Office). |
27 | | |
28 | | This is best as it handles complex resources best. |
29 | | |
30 | | via web: |
31 | | * http://myhost.com/eden/hms/hospital/create.fods?filename=myhospitals.fods |
32 | | |
33 | | or from Web2Py CLI: |
34 | | {{{ |
35 | | resource = s3xrc.resource("hms", "hospital") |
36 | | template = os.path.join(request.folder, resource.XSLT_PATH, "fods", "import.xsl") |
37 | | resource.import_xml("myhospitals.fods", template=template) |
38 | | }}} |