How to split a Webix datatable column into multiple columns? - datatable

In my webix datatable, I am showing multiple values in the cells for some columns.
To identify which values belong to which header, I have separated the column headers by a '|' (pipe) and similarly the values under them as well.
Now, in place of delimiting the columns by '|' , I need to split the columns into some editable columns with the same name.
Please refer to this snippet : https://webix.com/snippet/8ce1148e
In this above snippet, for example the Scores column will be split into two more editable columns as Rank and Vote. Similarly for Place column into Type and Name.
How the values of the first array elements is shown under each of them will remain as is.
How can this be done ?
Thanks

While creating the column configuration for webix, you can provide array to the header field for the first column along with the colspan like below:
var columns = [];
columns[0] =
{"id":"From", "header":[{"text":"Date","colspan":2},{"text":"From"}]};
columns[1] =
{"id":"To","header":[null, {"text":"To"}]};
column[0] will create Date and From and column[1] will be creating the To.

Related

Google Sheets: display all values existing in column A when a specific string exist elsewhere on that row

I want to display all values existing in column A when a specific string exist elsewhere on that row.
The formula in B10 should display "Table, Bed" in any form.
=ARRAYFORMULA(JOIN(",",IF(C3:E5=A10,A3:A5,)))
Comparison = within a array formula produces the desired array. Join them with ,

Conditional formatting in matrix cells

I have the following matrix loaded:
I need to change the font color of the BB column values ​​when the value is below the value contained in the MIN column cell.
Being grouped columns, the MIN column will not always be in fourth place. How can I do to compare values ​​taking into account the name of the columns?
Thank you!!
I share the output of the dataset:
I have found a solution based on our discussion in the comments:
Create a calculated field in your dataset Ref = ELEMENT + COMPONENT (concatenate the 2 colums, this will be used later)
In the Row Group properties, add a variable MinVar =lookup("MIN" & Fields!Component.Value ,Fields!Ref.Value,Fields!Value.Value,"DataSet1") (replace DataSet1 with your dataset name)
In the font expression of the value field add an expression =if(Fields!Element.Value ="BB",if(Me.Value< Variables!MinVar.value,"Red","Black") ,"Black")
I have tested this and it is working on my end.

Remove all columns to the right of a specific column

I have an Excel template file with a dynamic number of columns that represent work week dates. Some users have decided to add their own subtotal columns to the right of those columns. I need a way to identify the first blank column, and then truncate that column and all columns following it.
I had previously been using the following script to remove all columns that begin with the word "Column":
// Create a list of columns that start with "Column" and remove them.
Removed_ColumnNum_Columns = Table.RemoveColumns(PreviousStepName, List.Select(Table.ColumnNames(PreviousStepName), each Text.StartsWith(_, "Column") )),
Based on being able to find the first ColumnXX column, I want to remove it and all columns after it
You can use List.PositionOf to get your ColumnIndex instead of parsing text.
I'd put it together like this:
// [...]
ColumnList = Table.ColumnNames(#"Promoted Headers"),
ColumnXX = List.Select(ColumnList, each Text.StartsWith(_, "Column")){0},
ColumnIndex = List.PositionOf(ColumnList, ColumnXX),
ColumnsToKeep = List.FirstN(ColumnList, ColumnIndex),
FinalTable = Table.SelectColumns(#"Promoted Headers", ColumnsToKeep)
Remove Columns after ColumnXX
Find the first column that begins with the name "Column" and delete that column and all columns following it. This parses the XX as the column index so you need to make sure you haven't deleted columns prior to this step. i.e. "Column35" needs to be the 35th column at this step in the code.
// Find the first ColumnXX column and remove it and all columns to the right.
ColumnXX = List.Select(Table.ColumnNames(#"Promoted Headers"), each Text.StartsWith(_, "Column")){0},
ColumnIndex = Number.FromText(Text.Middle(ColumnXX, 6,4)),
ColumnListToRemove = List.Range(Table.ColumnNames(#"Promoted Headers"),ColumnIndex-1),
RemovedTrailingColumns = Table.RemoveColumns(#"Promoted Headers", ColumnListToRemove),
To make this more robust I would prefer to have a way to identify the column index of columnXX without parsing the digits from it.

Hashing methodology for collection of strings and integer ranges

I have a data, for example per the following:
I need to match the content with the input provided for the Content & Range fields to return the matching rows. As you can see the Content field is a collection of strings & the Range field is a range between two numbers. I am looking at hashing the data, to be used for matching with the hashed input. Was thinking about Iterating through the collection of individual strings hashcode & storing it for the Content field. For the Range field I was looking at using interval trees. But then the challenge is when i hash the Content input & Range input how will i find if it that hashcode is present in the hashcode generated for the collection of strings in the Content fields & the same for the Range fields.
Please do let me know if there are any other alternate ways in which this can be achieved. Thanks.
There is a simple solution to your problem: Inverted Index.
For each item in content, create the inverted index that maps 'Content' to 'RowID', i.e. create another table of 2 columns viz. Content(string), RowIDs(comma separated strings).
For your first row, add the entries {Azd, 1}, {Zax, 1}, {Gfd, 1}..., {Mni, 1} in that table. For the second row, add entries for new Content strings. For the Content string already present in the first row ('Gfd', for example), just append the new row id to the entry you created for first row. So, Gfd's row will look like {Gfd, 1,2}.
When done processing, you will have the table that will have 'Content' strings mapped to all the rows in which this content string is present.
Do the same inverted indexing for mapping 'Range' to 'RowID' and create another table of Range(int), RowIDs(comma seperated strings).
Now, you will have a table whose rows will tell which range is present in which row ids.
Finally, for each query that you have to process, get the corresponding Content and Range row from the inverted index tables and do an intersection of those comma seperated list. You will get your answer.

Using XPath to find rows where a specific column has value

I'm having trouble using XPath to find a row in a table where a specific column contains a value. The table has 10 columns where 2 of them will show Yes|No but I'm only interested in finding the value in one of the columns (the 4th one). My initial attempt was this:
//table[#id='myTable']/tbody/tr/td[text() = 'Yes']
but it finds it rows from both columns. I thought I could try something like this but it's not a valid expression:
//table[#id='myTable']/tbody/tr/td[4]/text()='Yes'
Any suggestions? Thanks.
You can try this way :
//table[#id='myTable']/tbody/tr[td[4][. = 'Yes']]
The XPath return row (tr) having the forth td child value equals "Yes".

Resources