Table2Base: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(spreadsheet formula examples added)
(todo added)
Line 2: Line 2:


'''Table2Base''' is an extension which enables direct upload of data from wikipages to Opasnet Base. Data is displayed as a table in wikipage.  
'''Table2Base''' is an extension which enables direct upload of data from wikipages to Opasnet Base. Data is displayed as a table in wikipage.  
{{todo|Tämä pitäisi saada toimimaan pikaisesti Heandessa, jotta toimii myös ei-julkiselle materiaalille. Pitäisikö myös avata se aiemmin puhuttu suojattu Opasnet-kanta? Miten suojattaisiin? Yksi tapa on pistää se THL:n palomuurin sisään, mutta muuten se voi rajoittaa liikaa sen käyttöä.|Juha Villman|project=Opasnet}}


==Usage==
==Usage==
Line 44: Line 46:
;Formula for the second row and beyond:=A2&"|"&B2&"|"&C2&"|"&D2
;Formula for the second row and beyond:=A2&"|"&B2&"|"&C2&"|"&D2


==Some old thinking==
==See also==
 
* [http://en.opasnet.org/en-opwiki/index.php?title=Table2Base&oldid=17451 Previous dicussion about the format of the table]
 
==Keywords==


Syntax which idea is based on:
==References==


{{datum list
<references/>
| Year
| Country
| Mortality
| unit = #
| explanations = 2
| observations = 1
}}
{{datum|2000|Finland| 40000 |desc=[[WHO mortality data]]}}
{{datum|2001|Finland| 50000 |desc=[[WHO mortality data]]}}
|}
* Indexes:
** year
** country
* result
** mortality


Possible solutions:
==Related files==
* we should not use exactly the same syntax as wikipages
* tag or parser?
* {{defend_invalid|1 |are explanation and observation really necessary? Could it look more like this?|--13:59, 6 October 2010 [[user:Juha Villman|Juha Villman]]}}
*: {{attack|2 |The title ''explanation'' is not necessary. Also the title for observations is only necessary if there are more than one observation columns. For example the data below could be in a format where there are three columns (''Country'', ''2000'', and ''2001'') and only one row for the data. In this case, it is necessary to tell that the heading for the two observation columns is ''Year'', because this heading is used as index name (with locations 2000 and 2001). But is it true that the observation index name does not need to show up as a heading in the table. I changed the [[:Template:Datum list]] accordingly.|--[[User:Jouni|Jouni]] 15:52, 7 October 2010 (UTC)}}


{|class="wikitable sortable" {{prettytable}}
{{mfiles}}
|+ {{PAGENAME}}
!Year!!Country!!Mortality!!Description
|-
|2000||Finland||40000||[[WHO mortality data]]
|-
|2001||Finland||50000||[[WHO mortality data]]
|}

Revision as of 10:35, 19 November 2010

Table2Base is an extension which enables direct upload of data from wikipages to Opasnet Base. Data is displayed as a table in wikipage.

TODO: {{#todo:Tämä pitäisi saada toimimaan pikaisesti Heandessa, jotta toimii myös ei-julkiselle materiaalille. Pitäisikö myös avata se aiemmin puhuttu suojattu Opasnet-kanta? Miten suojattaisiin? Yksi tapa on pistää se THL:n palomuurin sisään, mutta muuten se voi rajoittaa liikaa sen käyttöä.|Juha Villman|Opasnet}}


Usage

Example:

<t2b index="Year,Country" unit="#" obs="Mortality">
2001|Finland|1000
2002|Finland|2000
2001|Sweden|900
2002|Sweden|800
</t2b>

Displays:

Table2Base: Difference between revisions(#)
ObsYearCountryMortality
12001Finland1000
22002Finland2000
32001Sweden900
42002Sweden800

Notes:

  • index argument defines indices of the datatable:
    • example has 2 indices: Year and Country
    • it is obligatory to have at least 1 index
  • unit defines the unit of the variable
    • it is obligatory to define unit
  • obs defines the name of the result column
    • obs is optional
    • if not defined default value "Result" is used
  • Data is saved only when table is altered and page is saved
  • Number of data columns must match to number of indices + result column
  • Each row must have equal number of columns
  • Table caption is a link to Base UI


Hints for spreadsheet software

If you have your data table in Open Office Calc, Excel, or some other software, you can use these formulas to convert tables into Table2Base code. This example is for Excel, other software may have slightly different syntax. Here, the data is in the spreadsheet in columns A...D. Columns A...C contain index values and column D observations. The first row contains index names and rows starting from row 2 contain data.

Formula for the first row
="<tb2 index="&CHAR(34)&A1&","&B1&","&C1&CHAR(34)&" unit="&CHAR(34)&"kg"&CHAR(34)&" obs="&CHAR(34)&D1&CHAR(34)&">"
Formula for the second row and beyond
=A2&"|"&B2&"|"&C2&"|"&D2

See also

Keywords

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>