How to insert a markdown table in IntelliJ IDEA? - intellij-idea

I'm using IDEA 2019.3 Ultimate edition which ships with markdown support. I'm trying to insert a table like this:
| Key | Func |
|-------|--------|
| cmd+n | search |
but I found tab not working and IDEA doesn't help to indent the table so I have to manually add lots of -. Is there an efficient way to insert a table in IDEA?

Intellij community edition 2020.3.3
|header 1|header 2|
---|---
|xyz|x|
|xyz|y|

Make sure there is an empty line above the table for it to be rendered:
Some texts:
| Tables | Are | Cool |
|----------|:-------------:|------:|
| col 1 is | left-aligned | $1600 |
| col 2 is | centered | $12 |
| col 3 is | right-aligned | $1 |
(using activedecay's text example)

Works for me in IntelliJ IDEA version 2020.2.3
| Tables | Are | Cool |
|----------|:-------------:|------:|
| col 1 is | left-aligned | $1600 |
| col 2 is | centered | $12 |
| col 3 is | right-aligned | $1 |

Since 2022.1 you can use Code > Generate... > Table or Insert... > Table (cmd-N) to insert tables.
You can checkout official IDEA documentation for table support in Markdown plugin.

I don't think this is possible at the moment.
As a workaround you can use the Markdown Table Generator which lets you generate the markdown code while being able to input data in a normal table.

This does not address the OP's original problem, but hopefully it can help others that arrive here as a result of IDEA not rendering their markdown tables.
In my case I needed to add more - characters on the second line. IDEA seems to require a minimum of 3 dashes in order to display the markdown table.
Incorrect
Input
| Some | Table | Header | Values |
| :-: | :-: | :-- | --: |
| Centre | Centre | Left | Right |
Output
| Some | Table | Header | Values |
| :-: | :-: | :-- | --: |
| Centre | Centre | Left | Right |
Correct
Input
| Some | Table | Header | Values |
| :---: | :---: | :--- | ---: |
| Centre | Centre | Left | Right |
Output
-----------------------------------
| Some | Table | Header | Values |
| Centre | Centre | Left | Right |
-----------------------------------

Related

Import and Export Wizard SQL Server 2012

Is there an feature on the Import/Export Wizard of SQL Server which allows me to do the following? If so, how can I go about it...
Before
+---------+-------------+----------+------+
| Name | Description | Delivery | Cost |
+---------+-------------+----------+------+
| dfdsf | dfgdfgdf | 34 | |
| sdfsdgf | dfgdfgdf | 324 | |
| dfg | dfgdfgdf | 23 | |
| dfgfdg | gdf | 43 | |
| dfgdfg | gdf | 23 | |
| fdgfdg | fgd | 443 | |
+---------+-------------+----------+------+
+---------+-------------+----------+------+
| Name | Description | Delivery | Cost |
+---------+-------------+----------+------+
| dfdsf | dfgdfgdf | 34 | |
| sdfsdgf | dfgdfgdf | 324 | |
| dfg | dfgdfgdf | 23 | |
| dfgfdg | gdf | 43 | |
| dfgdfg | gdf | 23 | |
| fdgfdg | fgd | 443 | |
| | | | 324 |
| | | | 324 |
| | | | 234 |
| | | | 234 |
| | | | 23 |
| | | | 423 |
+---------+-------------+----------+------+
So I have the table above:
I want to add the cost column in from a Flat File (CSV source, made on Excel).
Can I do this on the wizard without removing the other data - I have tried multiple different options on the wizard, but I seem to keep removing the data or the data added creates another set of row, so it will look like bottom table.
I do have a primary key on this table and I have set that to increase automatically by 1 - I have also got foreign keys, though I had to remove the relationships temporarily to allow me to even get the data onto the table.
Sorry the formatting isn't clear - The top table represents my table and the bottom table shows what happens when I input data - What I want is a the cost column aligned with the old data.
Any help would be much appreciated.
If you want to update existing records in the table you need to be able to identify a relationship between the rows in your table and the rows in your CSV file.
To update the rows in the existing table import the CSV file into a separate table. Then run an UPDATE statement like the one below to update the rows in the existing table with the data from the new table.
UPDATE T
SET T.Cost = S.Cost
FROM dbo.MyTable AS T
JOIN dbo.CsvInput AS S
ON T.ID = S.ID

Get an extra row with a join

Assume I have the following tables
CHAPTERS
| ID | Title |
---------------------
| 1 | Introduction |
LINES
| ID | Chapter | Line |
--------------------------------------
| 2 | 1 | Fourscore and ... |
| 5 | 1 | In the beginning... |
What I'm looking for in my SQL result is the following
| Title | Line |
-----------------------------
| Introduction | null |
| Introduction | Fourscore |
| Introduction | In the beg |
So basically I want an extra row with just the Title and other rows with te matching lines.
All I've got now is just the 2 rows with the lines without the missing null-line with just the title.
Any ideas?
Try this
select title,null as Line from chapters
union
select title,line from chapters a join lines b on a.id=b.chapter

I'm wanting to combine unknown number of rows into one

Here is an example of data:
TABLE: DRIVERS
ID | FNAME | LNAME
------+-------+------
WR558 | WILL | RIKER
WW123 | WALT | WHITE
TABLE: ACCIDENTS
DRIVER | ACCIDENT_NBR | ACCI_DATE | ACCI_CITY | ACCI_ST
-------+--------------+------------+-----------+--------
WW123 | 4-7777 | 2014-01-01 | Chicago | IL
WW123 | 4-7782 | 2014-01-03 | Houston | TX
WW123 | 4-7988 | 2014-01-15 | El Paso | NM
There could be any number of accidents listed for this driver in this table or there could be none
What i need to see is this:
ID | FNAME | LNAME | ACCIDENT1_NBR | ACCI1_DATE | ACCI1_CITY | ACCI1_ST | ACCIDENT2_NBR | ACCI2_DATE | ACCI2_CITY | ACCI2_ST | ACCIDENT3_NBR | ACCI3_DATE | ACCI3_CITY | ACCI3_ST | ... | ACCIDENT10_NBR | ACCI10_DATE | ACCI10_CITY | ACCI10_ST
------+-------+--------+---------------+------------+------------+----------+---------------+
WR558 | WILL | RIKER | | | | | | ...
WW123 | WALT | WHITE | 4-7777 | 2014-01-01 | Chicago | IL | 4-7782 | ...
I need to pull the driver info and the 10 most recent accidents (if any) onto this one line. I'm unsure if I need to use a PIVOT table or a FETCH. Either way, I'm not sure how to iterate into the columns as needed.
Anyone's assistance is greatly appreciated!
I'm using SQL Server 2012 and this will ultimately get pulled into a .XLS SSRS file. The pipes I included are only for display and will not be part of the final result
You should use PIVOT for this as ugly as it will be it is the correct choice if coding a C# solution is not viable.
Here is an example: Simple Pivot sample

how to make the data sorts like this on sql server

I've a data that looks like this
| FormCode | Description | MenuPath |
+----------+----------------------+-------------+
| PY | Payroll | |
| PD | Personal Development | |
| EM | EmployeeMaster | PY |
| EB | EmployeeBank | PY |
| ED | EmployeeData | PY |
| Report | Report | PY |
| Badge | Badge Report | PY/Report |
| Process | Process | PY |
| Bonus | Bonus Component | PY/ED |
|Preference| Preference | PY |
| Tax | Tax Result | PY/ED |
|FinalBonus| FinalBonus | PY/ED/Bonus |
| Annual | Annual Process | PY/Process |
|BonusbyCC | Bonus by Cost Centre | PY/ED/Bonus |
| Period | Period |PY/Preference|
I want this data sort to be like this below.
| FormCode | Description | MenuPath |
+----------+----------------------+-------------+
| PY | Payroll | |
| EB | EmployeeBank | PY |
| ED | EmployeeData | PY |
| Bonus | Bonus Component | PY/ED |
|BonusbyCC | Bonus by Cost Centre | PY/ED/Bonus |
|FinalBonus| FinalBonus | PY/ED/Bonus |
| Tax | Tax Result | PY/ED |
| EM | EmployeeMaster | PY |
|Preference| Preference | PY |
| Period | Period |PY/Preference|
| Process | Process | PY |
| Annual | Annual Process | PY/Process |
| Report | Report | PY |
| Badge | Badge Report | PY/Report |
| PD | Personal Development | |
That's the result of the sorting
Explanation :
I will try to explain the sorting. At first we look at the formcode. it will put PY on the first row. After that, there will be the row where MenuPath was PY (sort by alphabeth on the description). In this case EmployeeBank show first. If it doesn't have any child path, the next row will be EmployeeData. after that, EmployeeData has a child like we could see there's Bonus Component(sort by Description) on the next row. After that, if it doesn't have any child, the next row will be Tax Result, but as you can see, Bonus Component still has a child (Bonus by Cost Centre and FinalBonus) so this 2 data will appear after Bonus Component. Tax Result will appear next. The process will keep like that until the end of data.
Sorry if my english messed up and my explanation not good at all. If anyone understand what I mean and could fix my english on the explanation please do it
Thanks for the help
There is absolutely no logic to sort in a way in which you have shown us ..however you can achieve so by assigning some kind of ID to your field and then sort on it
SELECT * FROM Table1
ORDER BY CASE [FormCode]
WHEN 'PY' THEN 1
WHEN 'EM' THEN 2
WHEN 'EB' THEN 3
WHEN 'ED' THEN 4
WHEN 'Bonus' THEN 5
WHEN 'BonusbyCC' THEN 6
WHEN 'FinalBonus' THEN 7
WHEN 'Tax' THEN 8
WHEN 'Preference' THEN 9
WHEN 'Period' THEN 10
WHEN 'Process' THEN 11
WHEN 'Annual' THEN 12
WHEN 'Report' THEN 13
WHEN 'Badge' THEN 14
WHEN 'PD' THEN 15
END;
SAMPLE FIDDLE

Multiple model form

Let say that I have an interface for inputting vehicle marketing information
+--------------------+
| Vehicle |
|--------------------|
| | +--------------------------------------------------+
| Marketing info +----->| Marketing info |
+--------------------+ |--------------------------------------------------|
| | | |
| Engine info | | |
+--------------------+ | +--------------------------+ |
| | | Name | | |
| Wheels | | | | |
+--------------------+ | +--------------------------+ |
| | | |
| Doors | | +--------------------------+ |
+--------------------+ | Codename | | |
| | | | | |
| Seats | | +--------------------------+ |
+--------------------+ | |
| +--------------------------+ |
| Disinformation | | |
| | | |
| | | |
| | | |
| +--------------------------+ |
+--------------------------------------------------+
I am in a the first page for that vehicle, I want a vehicle to have it's information save in different tables, for example it can have one marketing_info but many wheels or doors
The problem that I am seeing is that the menu on the left has to link to the related model's forms from the new action so the link helpers will encounter nil id's
If I used just one big form and hid the sections I didn't want the users to see, would that be the best option?
I would also like that form to save as it goes along but then move along the steps in the form, how can I do that? Would I have to redirect to the edit action using an anchor to the next step?
Should I do the following:
One big form with hidden steps, with multiple submit buttons on each step
a step is shown if it is in the anchor i.e #step1 or in the examples case #marketinginfo
I want to save on any of the steps.
Once I have saved I need to be in the edit view
Basically you want multi step form http://railscasts.com/episodes/217-multistep-forms
and nested form bcz info goes into different tables http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html
you can have different action for each step of form fill-up