How to add a checkbox within a markdown table in Gitlab? - checkbox

I am trying to set up a table in markdown that I can store in a Gitlab Wiki.
The table looks something like this:
| Col1 | Col2 | Col 3 | Col4 |
| :---: | :---: | :---: | --- |
| ID1 | Yes | No | some text |
Here is how the table looks:
Col1
Col2
Col 3
Col4
ID1
Yes
No
some text
What I would like to do instead of editing and changing the cell to be Yes or No manually, that I could use a checkbox, normally "- [ ]" should work but apparently does not work inside of table.

Related

Multi-cell Row and Column Headers wpf

After a lot of google search, I got an example on merging Header columns and adding rows as per my requirement but it is c1flexgird code I am not able to convert in WPF main form.
https://www.grapecity.com/componentone/docs/wpf/online-flexgrid/MultipleCellRow.html
My data structure also like
col1 | col1 | col2 | col2 | col3 | col3
and I want add rows like below
col1 | Col2 | col3
A | B | A | B | A | B
Please have a look on my issue to fix my problem. Thanks

How to mark selected columns of a table for display

I use PostgreSQL 10.1 and:
CREATE TABLE human
(
id ... NOT NULL,
gender ...,
height ...,
weight ...,
eye ...,
hair ...,
...
);
I have an input form through which I insert the data. I wish an elegant and proper way by which I can SELECT which columns required to be DISPLAYED in that form, something like weight ... DISPLAYED, or eye ... NOT DISPLAYED, .
One way is to correspond NULL with DISPLAYED (when NOT NULL then display it, or when NULL then do not display it) and use information_schema which (corresponding) makes me no so happy:
Another way is to:
CREATE TABLE human_column
(
id ... NOT NULL,
characteristic character varying(...),
is_displayed boolean
);
where characteristic data are the names of the columns of human table.
Is there a better way to add a direct foreign attribute to the columns of a table? (In 51.7. pg_attribute there is a column named attoptions. Would it be used?)
specifying "options" for columns to define if they will be "displayed" or not seems a little overhead. Imagine you keep such list in human_column. To modify it you would need to update it with new is_displayed values. Then you would need to build column list to be selected in query.
When you create a view, you do the same (specify a list of columns to be displayed) and then you can just query the view, without need to dynamically build the query. Also you can always check the current list of included columns from catalog or information_schema.
The only "not cosy" feature of a view - you can't change columns in it, thus you have to drop and create it again.
drop/create view on demand looks cheaper to me then dynamically building query with list of columns on each select still.
demo:
db=# create view v as select oid,datname from pg_database;
CREATE VIEW
db=# select * from v;
oid | datname
-------+-----------
13505 | postgres
16384 | t
1 | template1
13504 | template0
16419 | o
(5 rows)
checking list of columns:
db=# select column_name,ordinal_position,column_default,is_nullable,data_type,character_maximum_length from information_schema.columns where table_name = 'v';
column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length
-------------+------------------+----------------+-------------+-----------+--------------------------
oid | 1 | | YES | oid |
datname | 2 | | YES | name |
(2 rows)
same for original table:
db=# select column_name,ordinal_position,column_default,is_nullable,data_type,character_maximum_length from information_schema.columns where table_name = 'pg_database';
column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length
---------------+------------------+----------------+-------------+-----------+--------------------------
datname | 1 | | NO | name |
datdba | 2 | | NO | oid |
encoding | 3 | | NO | integer |
datcollate | 4 | | NO | name |
datctype | 5 | | NO | name |
datistemplate | 6 | | NO | boolean |
datallowconn | 7 | | NO | boolean |
datconnlimit | 8 | | NO | integer |
datlastsysoid | 9 | | NO | oid |
datfrozenxid | 10 | | NO | xid |
datminmxid | 11 | | NO | xid |
dattablespace | 12 | | NO | oid |
datacl | 13 | | YES | ARRAY |
(13 rows)

SQL Server - Is it possible to define a table column as a table?

I know that this is possible in Oracle and I wonder if SQL Server also supports it (searched for answer without success).
It would greatly simplify my life in the current project if I could define a column of a table to be a table itself, something like:
Table A:
Column_1 Column_2
+----------+----------------------------------------+
| 1 | Columns_2_1 Column_2_2 |
| | +-------------+------------------+ |
| | | 'A' | 12345 | |
| | +-------------+------------------+ |
| | | 'B' | 777777 | |
| | +-------------+------------------+ |
| | | 'C' | 888888 | |
| | +-------------+------------------+ |
+----------+----------------------------------------+
| 2 | Columns_2_1 Column_2_2 |
| | +-------------+------------------+ |
| | | 'X' | 555555 | |
| | +-------------+------------------+ |
| | | 'Y' | 666666 | |
| | +-------------+------------------+ |
| | | 'Z' | 000001 | |
| | +-------------+------------------+ |
+----------+----------------------------------------+
Thanks in advance.
There is one option where you can store data as XML
Declare #YourTable table (ID int,XMLData xml)
Insert Into #YourTable values
(1,'<root><ID>1</ID><Active>1</Active><First_Name>John</First_Name><Last_Name>Smith</Last_Name><EMail>john.smith#email.com</EMail></root>')
,(2,'<root><ID>2</ID><Active>0</Active><First_Name>Jane</First_Name><Last_Name>Doe</Last_Name><EMail>jane.doe#email.com</EMail></root>')
Select ID
,Last_Name = XMLData.value('(root/Last_Name)[1]' ,'nvarchar(50)')
,First_Name = XMLData.value('(root/First_Name)[1]' ,'nvarchar(50)')
From #YourTable
Returns
ID Last_Name First_Name
1 Smith John
2 Doe Jane
Actually, for a normalized database we do not require such functionality.
Because if we need to insert a table within a column than we can create a child table and reference it as a foreign key in the parent table.
In spite, if you still insist to such functionality than you can use SQL Server 2016 to support JSON data where you can store any associative list in JSON format.
Like:
DECLARE #json NVARCHAR(4000)
SET #json =
N'{
"info":{
"type":1,
"address":{
"town":"Bristol",
"county":"Avon",
"country":"England"
},
"tags":["Sport", "Water polo"]
},
"type":"Basic"
}'
SELECT
JSON_VALUE(#json, '$.type') as type,
JSON_VALUE(#json, '$.info.address.town') as town,
JSON_QUERY(#json, '$.info.tags') as tags
SELECT value
FROM OPENJSON(#json, '$.info.tags')
In older versions, this can be achieved through xml as shown in previous answer.
Your can also make use of "sql_variant" datatype to map your table.
Previously, I was also in search of such features as available in Oracle. But after reading various articles and blogs from experts, I was convinced, such features will make the things more complex beside helping.
Only storing the data in required format is not important, It is worthy when it is also efficiently available (readable).
Hope this will help you to take your decision.

Database Views to simulate normalised tables from a single denormalised one

We have a report store with a denormalised flat table that stores identical data to a multi-table model in a different database.
Flat table (example):
| col 1 | col 2 | col 3 | timestamp |
|-------|-------|-------|-----------|
| val1 | val2 | val3 | 1/1/1990 |
| val1 | val9 | val3 | 1/1/1990 |
In multiple tables:
| id1 | id2 | timestamp |
|-----|-----|-----------|
| 001 | 111 | 1/1/1990 |
| 001 | 112 | 1/1/1990 |
| id1 | col 1 | col 3 |
|-----|-------|-------|
| 001 | val1 | val3 |
| id2 | col 2 |
|-----|-------|
| 111 | val2 |
| 112 | val9 |
There are several old reporting queries that we would like to port over to the new flat table without having to rewrite them all up front - there are many of them and they are complex.
Is there a way of writing Views that can simulate a set of relational tables from the single flat table, so that the old reporting queries work without modification?
HereI create dynamical IDs. You could also initialy make that table with fix keys, and always when adding or removing a row in the flattable do the same with the key here. Otherwise instead of Groub by use the OVER statement.
CREATE VIEW multitabkey AS
SELECT ROW_NUMBER() as key, col1, col3
FROM flattable
Group by col1, col3
WARNING: those keys are not persistent: if you delete the first row, all others get their id one smaler than before. You have dynamic IDs, but they are consistnet.
If you have a translation for your Keys you can use them as following:
CREATE VIEW multitabone AS
SELECT f.timestamp
FROM flattable as f
JOIN multitabkey as m ON m.col1 = f.col1 AND m.col3 = f.col3
Group by col1, col3
I assumed col1 , col2 are together a natural key.
As mentioned, this is a workaround, your DB is not in 3rd normalform what can cause inconsistency.

SSRS. How to merge cells using expressions?

I have 3 columns and here are 2 possible ways:
1. In all of them are values
2. Only col1 keeps value (col2 and col3 NULL)
For now It looks like:
| col1 | col2 | col3 |
----------------------
| val1 | | |
| val2 | val3 | val4 |
| val5 | val6 | val7 |
| val8 | | |
It should be like this:
| col1 | col2 | col3 |
----------------------
| val1 | -- merged cells, because col2 and col3 empty
| val2 | val3 | val4 |
| val5 | val6 | val7 |
| val8 | -- merged cells, because col2 and col3 empty
I don't have idea If I need to create groups (I've tried row/column grouping, but really unsuccessfully, far away from what I need).
As I think I need to write expression something like:
IFF(col2 & col3 = NULL) MERGE(col1, col2, col3)
Just I can't get success with expression's structure.
I don't think in SSRS it is possible to merge cells dynamically using expressions. Only way I can think of is having a fourth text box(Probably below the 3 on top) which contains the Col1, Col2 and Col3 in a concatenated fashion. Then you can set the condition for visibility on these two sets of textboxes. i.e. If Col2 and Col3 are NULL, hide the top 3 text boxes and make the fourth visible. On the other hand if Col2 or Col3 are not NULL, show the top 3 and hide the fourth one.
I think that you can do this by using an expression for each of the cells in a row like this:
Column 1:
=iif(isNothing(col2) AND isNothing(col3), "", col1)
Column 2:
=iif(isNothing(col2) AND isNothing(col3), col1, col2)
Column 3:
=iif(isNothing(col2) AND isNothing(col3), "", col3)
This sort of bypasses the need to merge, which should be faster and easier to implement.
Can you try IsNothing instead of = NULL ?
EX: =IIF(IsNothing(Fields!MyField.Value),Fields!MyFields.Value,Fields!MyFields.Value)
If needed use IIF condition again...

Resources