Create table within a table in a wiki page - mediawiki

I want to create the following table within a table in a wiki page:
A : B (Line 1)
C : D
E : F1 G1 (Line 3)
F2 G2
F3 G3
H : I
One option is to create the main table with four columns. That would mean creating empty string for col 3, 4 for lines 1 (and similar ones). Is there
{|
|A
|:
|B
|
|
|-
(etc)
|}
I was wondering if there is a way to state that I want to create an embedded table for Row 3 / Col 3 element of the main table?
I tried the following:
{|
{|
|A
|:
|B
|-
|C
|:
|D
|-
|E
|:
{|
|F1
|G1
|-
|F2
|G2
|-
|F3
|G3
|}
|-
|H
|:
|I
|}
However the above did not work, "B", and "D" got indented to the right of the "F/G" table.
Any ideas?
Kind of related question, how do I escape characters single characters like "{" and "|" so they get displayed.

Embedding one table inside another should not be a problem. In your code there is a table cell missing after the nested table, that could maybe mess things upp in some browsers. The follwing works well in every browser I try:
{| border="1"
|A
|:
|B
|-
|C
|:
|D
|-
|E
|:
{|
|F1
|G1
|-
|F2
|G2
|-
|F3
|G3
|}
|
|-
|H
|:
|I
|}
to use special characters such as pipe in MediaWiki wiki code, the easiest way (and less confusing for other editors) is to include it in <nowiki> code:
<nowiki> { | } </nowiki>
On a related note: Problems do arise when you start using parser functions inside tables, as the pipe character then have a special meaning. The most common solution to this problem (frequently used on Wikipedia,for instance), is to create a template (usually called Template:!, as ! visually resembles |), containing only the single character |. You can then use {{!}} as a substitute for | inside not only tables, but also template variables.

Related

Redshift transformation: json key/value to relation

in the Redshift table I have the tag column, which is varchar storing json with typical key/value pairs. E.g. for record with id = 1 the tag value looks like: {"env":"test","app-name":"ap123","product-type":"web-app"}.
I would like to transform the key/values to the typical relational table like below:
+---+-------------+-------+
|id ||key |value |
+---+-------------+-------+
|1 |env |test |
|1 |app-name |ap123 |
|1 |product-type |web-app|
|2 |env |dev |
|...|... |... |
+---+-------------+-------+
I had made a fast research already I didn't found any solution. I tried to use the Redshift json functions, but without achieving the desired result (https://docs.aws.amazon.com/redshift/latest/dg/json-functions.html).
Any ideas are highly wellcome.
The idea in this situation was to change the json to json_array by adding enclosing brackets ('[' and ']') to the json and replace ',' with the '}, {' to change separate json_array elements. Afther that it's possible to access the json_array element by the json_extract_array_element_text function.

Ugly, broken table in pdf generated by sphinx latexpdf from rst

need some help with sphinx latexpdf output.
Have an document version csv-table in rst file. In html looks perfect, in pdf terrible.
my table:
.. csv-table::
:header: Version, Date, Description
:widths: 15, 20, 50
34343, 02/04/2015, "| Added *httsdfsdps* support"
3434, 14/11/2014, "| Added *folsdfsdlow* parameter to *hgfhfg*"
34343, 13/05/2014, "| Added *fdsf* parameter to *dfgdfgdfgdfgfdgdfgdfgdf*"
21321, 29/10/2013, "| Added *sdfsdf* parameter to *dfgsgfds*
| Deprecated afsfsdf interface"
312321, 05/03/2013, "| Added *dsfsdfsddsfsd* parameter to *dfgdfgdfgdfgdfgdf*
| Documented *dfgdgd*"
213211, 28/02/2013, "Added *!=* operator in *fghfghfg*"
2132132, 26/02/2013, "Added *dsfsdfsdfsdfsdfsd* in *fghf*"
213219, 07/02/2013, "| Added *jsonhash* event format
| Added *filter* parameter in event connection
| Added *group* and *map* parameter to *nph-muu-sf*"
21321321, 30/01/2013, "| Added *height* parameter in *dfgdfgdfdfg*
| Added *dfgdfgdfgdf* in dfgdfgdfgdf"
HTML
PDF
Table is not full in pdf. And this style with spaces at top, bottom near text in cells. Why latex does not take size from rst?
Can i make it better? How?
Thanks for help!
I know your question has been posted for a while, but in case it is still an issue, and for posterity who may come upon this here is how I fixed this issue in an rst doc of my own. I had the same issue, but using a standard rst table drawn out explicitly like so.
+--------+--------+---------+
|Column 1|Column 2| Column 3|
+========+========+=========+
|Value |Value |Value |
+--------+--------+---------+
And so on with many cells that would show the same behavior of running over the page end. The solution was using the class: longtable argument, and then very carefully indenting the table so that the class was applied. Like so:
.. table:: Table Title
:class: longtable
+--------+--------+---------+
|Column 1|Column 2| Column 3|
+========+========+=========+
|Value |Value |Value |
+--------+--------+---------+
This when rendered in pdf would properly break the table over multiple pages. You should be able to use the same class on a csv table.
that is my solution:
this issue in my .rst document is because my table is not too long. if your table is much longer, it will switch to next pages automatically. i have 20 rows in my table. so i change one row:
+-----------+-----------+
| | |
| | |
| | |
+-----------+-----------+
to
+-----------+-----------+
| | |
+ + +
| | |
+-----------+-----------+
it will not change your table style in pdf, but actually the table become 21 rows. when my table has 30 rows. it switch to next pages automatically. but this way may be a little stupid...
The list-table directory works. Just include the longtable class.
Example:
.. list-table:: Table Name
:widths: 5 30
:header-rows: 1
:align: center
:class: longtable
* - **Column1**
- **Column 2**
* - Row1itemsforcolumn1
- Row1itemsforcolumn2
.
.
.very very long table
.
.
* - Row1itemsforcolumnn
- Row1itemsforcolumnn
This gives a clean-looking PDF output whereby the contents are continued on the next page.
Final Output

EAV how to store additional field value?

I have a EAV structure in DB and tables: attribute(id,parent_id,code,name) and value(id,entity_id,attribute_id,value).
I'm using parent_id to store attribute's list. For example,
id | parent_id | code | name
1 | null | color_id | Color
2 | 1 | null | Red
3 | 1 | null | Blue
4 | 1 | null | Other
Now I need the ability to store different data on select certain item. This may be one or more inputs. For example:
Color:
(o) Red
(o) Blue
(o) Other (please specify) ______________
How to store it? Create additional table or may be store with parent_id pointed to selected element or something else?
id | parent_id | code | name
4 | 1 | null | Other
5 | 4 | other_one | First text value
6 | 4 | other_two | Second text value
Thought a little bit about it... Here's a try to give you an answer to the question "How to store it":
Make sure, that you get partial structure into your concept. Define kind of types, value packages, things which belong together and use XML. Something like the above could loke like:
<settings>
<parent id="1">
<colors>
<color>Red</color> --here you should think of tags to set the meaning of the color...
<color>Red</color>
<color>Other</color> --here you set whatever color you want
</colors>
</parent>
<parent id="2">
-- Your example with the "First text value" gives me this idea:
<colors>
<color meaning="BackColor">Red</color>
<color meaning="BorderColor">Red</color>
<color meaning="First text value">Blue</color>
<color meaning="Second text value">Green</color>
</colors>
</parent>
</settings>
So my suggestion:
Try to define certain types like "FormColor" and let it be like
<FormColor backcolor="Red" forecolor="blue" first_text="green">
--You may add specialities within the FormColor-element
<SpecialColor meaning="SomeSpecialMeaning">Blue</SpecialColor>
</FormColor>
Place these "types" within a parent element. You can easily pick the parent element via id and read its inner XML. There you find everything you need...
With this approach you are as flexible as with your EAV thing, but much better readable, maintainable and better to evaluate.

Output data from a MySQL table one time with php

I have a mysql table with a column that looks something like this:
| TAGS |
------
|Green |
|Blue |
|Orange|
|Blue |
|Green |
| ... |
------
Now what I want to do is output all the different tags that exist in a list, BUT every tag can only be outputted once (so e.g. 'Green stands two times in the database but can only stands one time in the list')
Hope you understand my question!
Thanks
You said "row" but do you mean a column labeled "tags" in your table?
There are two different ways:
Method 1:
SELECT DISTINCT tags FROM table_name WHERE condition;
Method 2:
SELECT tags FROM table_name WHERE condition GROUP BY tags;
They both will return a you an array where each item in the row is the tag without repeats (distinct). The main difference is that DISTINCT makes it easier to optimize (and possibly quicker).
Now, if you didn't make a typo and said that you have a row with a column that has multiple tags like:
|ROW_ID|TAGS |
| 1 |'Blue', 'Red' |
| 2 |'Red', 'Yellow' |
| 3 |'Blue', 'Black', 'Red'|
Then you'll have to do some parsing and array operations (but that's a completely different answer).

Some data is modified without apparent reason when importing .cvs to a MySQL db, any idea?

So I'm impoting a 80000+ lines .cvs files to a MySQL database, using Import CVS via LOAD DATA in phpMyAdmin, and it seems to work fine, there are no error messages.
Problem is, ater the import, all lines in the table, starting with line 24002 have the same number in one of my database fields, and this number doesn't even exist in the .cvs file I import.
Take this as an example:
+-----------+-----------+-----------+
|id |num 1 |num 2 |
+-----------+-----------+-----------+
|1 |03040304 |22222 |
|2 |03040305 |22223 |
|3 |03040306 |22224 |
|... |... |... |
|24001 |03064304 |46222 |
|24002 |21777777 |46223 | <- 21777777 doesn't exist in my .cvs file
|24003 |21777777 |46224 |
|... |... |... |
+-----------+-----------+-----------+
I tried different things, but nothing helped:
starting the import at line 24003
removing the lines 24001, 24002 from the .cvs file
removing the 24002 first lines from the .cvs file
importing the .cvs file without LOAD DATA
This is an example line from the .cvs file:
"SOME NAME";"18/10/2004";"8250";"2157002001";"239423";"Done";"Name SURNAME"
There are no special characters involved, only a-z, A-Z and 0-9.
I have absolutely no clue where this error could come from, any ideas?
Thanks in advance
What is the definition for the "num 1" field in the database? Is it an int because the max value of an int is 2,147,483,647 which is less than 2,157,002,001.