I've got a specflow step table that I want to have the | (pipe) character as a part of the content.
Example:
Then the data should be
| Field | Value |
| SomeField | a|b|c |
But this doesn't work. How can I escape the pipe character?
Bah. I can't believe I didn't find this earlier. You CAN escape a pipe with the backslash, but the specflow syntax highlighter gets confused by it.
Then the data should be
| Field | Value |
| SomeField | a\|b\|c |
Related
Following up on an earlier question I had about horizontal vs vertical arrays, I have a question about it's respective delimiters.
Problem definition:
Hereby an example of an incorrect way of comparing two arrays:
{=SUMPRODUCT(--({"Apple","Pear"}={"Apple","Lemon","Pear"}))}
The correct way, in case of an English application countrycode would be:
{=SUMPRODUCT(--({"Apple","Pear"}={"Apple";"Lemon";"Pear"}))}
Within an English version (most likely more than just English) of Excel these delimiters would respectively be a comma , for horizontal arrays and a semicolon ; for vertical ones. Plenty of online information to be found on this.
Working on a machine with a Dutch country code on it's application however, it't a complete other story. It does frustrate that my delimiters would both be different, respectively ; and a \. Being able to rather simply retrieve the semi-colon it's proven to be tricky to find any documentation on these delimiters for international version.
Workaround:
Not knowing these delimiters up-front makes it tricky for anyone on a variety of international versions of the application to work with these type of formulas. A rather easy workaround would be to use TRANSPOSE():
{=SUMPRODUCT(--({"Apple";"Pear"}=TRANSPOSE({"Apple";"Lemon";"Pear"})))}
Going through the build-in evaluation we can then retrieve the backslash as the column seperator. Another way would be to use the Application.International property and it's xlColumnSeparator and xlRowSeparator.
Question
We can both find and even override the xlDecimalSeparator and xlThousandsSeparator through Excel (File > Options > Advanced), or VBA (Application.DecimalSeparator = "-") but where can we find:
A place to actually see which xlRowSeparator and xlColumnSeparator are used within your own application, other than the workarounds I described. Looking for an interface similar to thousands and decimal seperator and/or official MS-documentation.
Furthermore (not specifically looking for this), is there:
A place to override them just like the decimal and thousand seperators
If not through Excel interfaces, can we brute-force this somehow through VBA?
I'm very curious if official documentation is present, and/or if the above can be done.
Not claiming this is the right answer, but with the help from comments from other users, maybe the below can clarify things a bit:
With no sign of any official documentation on this matter, and seemingly random row and column delimiters #Gserg showed a trick to retrieve information for any LCID using these unique id's on MS office support under "Create one-dimensional and two-dimensional constants". While this is MS office support information, the delimiters you see there are FALSE. They might come up as . a , a ; a : a \ or even a |. You get this results by changing the LCID from the URL to a LCID of interest, e.g.: fr-fr.
Although there are about 600 different LCID's they all get redirected to a default LCID. With the help of #FlorentB. we discovered that not only the MS office support documentation is wrong, it seems that these delimiters are not that random after all. Looking at countries using a decimal point, they use the , as a column delimiter (a horizontal array) and a ; as a row delimiter (a vertical array). Countries using a decimal comma however use a \ as a column delimiter and a ; for rows respectively.
Changing the system country settings, checking all default LCID's in Excel, we ended up with the matrix below showing all row and column delimiters per default LCID:
| LCID | Row | Column |
|-------|-----|--------|
| ar-sa | ; | , |
| bg-bg | ; | \ |
| cs-cz | ; | \ |
| da-dk | ; | \ |
| de-de | ; | \ |
| el-gr | ; | \ |
| en-gb | ; | , |
| en-ie | ; | , |
| en-us | ; | , |
| es-es | ; | \ |
| et-ee | ; | \ |
| fi-fi | ; | \ |
| fr-fr | ; | \ |
| he-il | ; | , |
| hr-hr | ; | \ |
| hu-hu | ; | \ |
| id-id | ; | \ |
| it-it | ; | \ |
| ja-jp | ; | , |
| ko-kr | ; | , |
| lt-lt | ; | \ |
| lv-lv | ; | \ |
| nb-no | ; | \ |
| nl-nl | ; | \ |
| pl-pl | ; | \ |
| pt-br | ; | \ |
| pt-pt | ; | \ |
| ro-ro | ; | \ |
| ru-ru | ; | \ |
| sk-sk | ; | \ |
| sl-si | ; | \ |
| sv-se | ; | \ |
| th-th | ; | , |
| tr-tr | ; | \ |
| uk-ua | ; | \ |
| vi-vn | ; | \ |
| zh-cn | ; | , |
| zh-hk | ; | , |
| zh-tw | ; | , |
The apparent conclusion is that all countries use a semicolon as a row (vertical) delimiter. And depending on decimal seperator countries use a backslash or comma as a column (horizontal) delimiter within array formulas.
So even without proper MS-documentation, nor a place within the Excel interface (like thousand en decimal delimiter do have), on this matter it is apparent that knowing your country's decimal seperator will automatically mean you either use a \ or , as a column delimiter.
| Dec_Seperator | Row | Column |
|---------------|-----|--------|
| . | ; | , |
| , | ; | \ |
I would happily recieve more information about the above and/or presence of any correct MS office documentation to add to this.
It is possible to do this through native Excel (without VBA or add-ins) by querying Excel's C API, but I don't know of anywhere this is documented.
Go into Excel's Name Manager and click 'New...'. Enter a name such as GetColumnSeparator.
In the 'RefersTo:' box, enter the following to get the column separator:
=INDEX(GET.WORKSPACE(37), 14)
In an Excel cell, you can now enter this:
=GetColumnSeparator
and the comma (in English - or whatever symbol is in use on your machine) will be shown.
For the row separator you need to change the index number to 15:
=INDEX(GET.WORKSPACE(37), 15)
On an English machine, this will be the semicolon by default.
On machines where Excel's 'display language' is not English (meaning Excel's function names are translated), you will need a translated version of the above formula. Again I don't know of any documentation on this, so my best suggestion would be to install the English language pack, enter the formula in English, save the workbook, then revert to your original Excel language and re-open the workbook; Excel will translate the formula automatically.
Note that you will need to save the workbook as macro-enabled (e.g. .xlsm rather than .xlsx).
Sorry this is nearly three years late but I hope it helps.
How can I create datatable which displays record as the following:
| | SECOND |
| ONE | THIRD |
| | FORTH |
| | FIFTH |
e.g one to many. Can you help me?
There's no way to achieve it with Primefaces, AFAIK. You could use a subtable instead to do something like:
| ONE |
| SECOND | THIRD || FORTH || FIFTH |
Or even use a rowExpansion utility, which I usually use for most of my one to many cases.
If your requirement is to match exactly what you ask for, you could always go with a pure JSF implementation instead and try to style it using Primefaces CSS stylesheets.
Using subtable you can display 1 to N relation data like:
| ONE | SECOND |
| | THIRD |
| | FORTH |
| | FIFTH |
For that you need repeat ONE in each line, but display (rendered) it for first line only. See result using RichFaces
Consider you want to insert Errors and Warnings into the same database entity. How would you call the table?
Example:
+----+-------+---------+
| ID | TYPE | MESSAGE |
+----+-------+---------+
| 1 | ERROR | FOO |
| 2 | WARNG | BAR |
| 3 | ERROR | TXT |
+----+-------+---------+
Message would be my best personal guess, but English is not my mother tounge.
I would use Anomaly. It is also a nice Matrix reference, so some users may chuckle. :)
A collegue thinks Signal would be the generic term from a process point of view.
I have a list of words every is on its own line. This is the first column of a table. I'd like to create second column by hand.
I'd like to use some plugin now, that will create an ASCII table around the text, so I have nice formatting (the starting letters in each column should be in one "vertical line" or I should be able to quickly move to the correct position with one shortcut).
Is there such a plugin for vim that eases editing such tables and controls the formatting?
If you just want text alignment into table format, I use this and it works well:
http://www.vim.org/scripts/script.php?script_id=294
I wrote a command line tool a few years ago which does more closely what you want:
It allows you to edit a table in CSV format:
1,my table,another field
2,my table,yet another field
Then select the block in vim, and filter it using:
'<,'>!~/scripts/tab
This then gives you:
------------------------------------
| 1 | my table | another field |
| 2 | my table | yet another field |
------------------------------------
If you want to edit the table again, you can select the whole table and repeat with untab (which is just a symlink -> tab) which converts the table back to CSV again so that you can edit.
There's also various other options:
-------------------------------------------------------------------------
| Command/Option | Purpose |
|----------------|------------------------------------------------------|
| tab | Reads from stdin and tabulates comma seperated input |
| tab <-t> | Tabulates input and assumes first row are titles |
| tab <-h> | Prints this help |
| tab <-nb> | Tabulates without a border |
| tab <-fw X> | Wrap fields greater than X big don't break words |
| tab <-fs X> | Wrap fields greater than X big and break words |
| tab <-vp X> | Vertically pad table by X lines |
| tab <-hp X> | Horizontally pad fields by X chars |
| tab <-b X> | Tabulates with a border made from char X |
|----------------|------------------------------------------------------|
| untab | Reads from stdin and untabulates table input |
| untab <-b X> | Untabulate a table with border char X |
| untab <-nb> | Untabulate a borderless table |
-------------------------------------------------------------------------
I am editing a wiki file and would like to add a new column in between of two existing columns.
| *No* | *Issue* | *File* | *Status* |
| 1 | blah | foo | open |
| 2 | blah1 | foo1 | close |
Say, I want to insert a new column between the 3rd and 4th columns above. If I could search for the fourth match of the | character in a given line, I could replace that with | |. But how one can do that in Vim?
The end result would look like so:
| *No* | *Issue* | *File* | | *Status* |
| 1 | blah | foo | | open |
| 2 | blah1 | foo1 | | close |
How about recording a macro into register q by entering qq3f|a|<ESC>q in command mode (ESC means pressing the Escape key). Now you can apply this macro to each line by :%norm#q.
Additional bonus:
With this pattern you can add more complex actions, for example replicate the first column as column 3 (if cursor is at first column):
qqf yf|;;;p0q
Oh, and the answer to your question: Search 4th occurrence of | on a line is done by 3f| (if the cursor is at position 0 and on a | character as in your example).
Consider the following substitution command.
:%s/\%(.\{-}|\)\{4}\zs/ |/
:%s/\(|[^|]*\)\{3\}/&| /
Which means: on each line (%), find three occurrences (\{3\}) of a string that starts with | followed by any number of non-| ([^|]*), and replace that with itself (&) followed by |.
You can call sed in vim as a filter:
:%!sed 's/|/| |/4'