How to add group column name of our choice - grouping

I am grouping elements in ag grid table.
The default column name is Group.
Is it possible / how to add a name of our choice for the Group column
(different than column names we have in our table)?
https://www.ag-grid.com/javascript-grid/grouping/

You can change the headerName property of the Auto Group Column by providing a headerName property in the autoGroupColumnDef:
gridOptions: {
autoGroupColumnDef: {
headerName:'Athletes'
}
}
You can read more about this in the documentation: https://www.ag-grid.com/javascript-grid/grouping/#configuring-the-auto-group-column

Related

PowerApps get column names based on row data

I have a SharePoint list that I want to retrieve the column names from, based on the row value. The column names will then be matched against another SharePoint list.
In the below example I know the value of the Function column. Based on that, I want to know the column names of all columns where the checkbox in that row is checked.
I think I'm nearly there. I can filter the columns based on the job title and allowed values. The issue now is the "StartsWith". I want to filter the column names, but I don't know the name of the column to filter on. It has to loop trough all the columns. How do I do this?
Also I'm not sure if AllowedValues is the right way to filter the columns based on the value. Can someone verify this for me?
//Get job title
Set(selectedUserJobTitle, Office365Users.UserProfileV2(galleryDirectReports.Selected.userPrincipalName).jobTitle);
//Get questions starting with "Q", based on the selectedUserJobTitle and values being true
ClearCollect(colQuestions,
Sort(
Filter('Comp - Fuctions',
Function.Value = selectedUserJobTitle,
//TODO: Replace "Title" with actual column name
StartsWith(Title, "Q"),
AllowedValues = true
),
Title, Ascending
)
);

Extract table name and columns from SQL schema

I need help to export table-name & columns from table schema (DDL) using regex.
CREATE TABLE todos (
id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
team_id INTEGER NOT NULL,
title TEXT NOT NULL DEFAULT "Hello World!",
description TEXT NOT NULL UNIQUE,
UNIQUE (title),
PRIMARY KEY (id),
FOREIGN KEY (user_id) REFERENCES users (id),
FOREIGN KEY (team_id) REFERENCES teams (t_id)
ON UPDATE RESTRICT
ON DELETE RESTRICT
)
Table name
todos
2. Columns
id // as group 1 (column name)
INTEGER // as group 2 (column type)
NOT NULL // as group 3 (column nullable) empty if nothing
DEFAULT // as group 4 (default value for example "Hello World")
UNIQUE // as group 5 (column uniqueable) empty if nothing
Note: UNIQUE can be also on table level same as title column.
3. Primary key
id // as group 1 (primary key)
Table level: PRIMARY\sKEY\s+\(([^\)]+)\)
Column level: check below answer.
4. Foreign keys:
// first
user_id // as group 1 (foreign key)
users // as group 2 (reference table name)
id // as group 3 (reference primary)
// second
team_id // as group 1 (foreign key)
teams // as group 2 (reference table name)
t_id // as group 3 (reference primary)
ON UPDATE RESTRICT // as group 4
ON DELETE RESTRICT // as group 5
I've found a simple regex in [github] (https://github.com/yiisoft/yii2/issues/6351#issuecomment-91064631) but not support RESTRICT
/FOREIGN KEY\s+\(([^\)]+)\)\s+REFERENCES\s+([^\(^\s]+)\s*\(([^\)]+)\)/mi
Extract a table name:
CREATE\s+TABLE\s+([\w_]+)
Get column names:
\s+([\w_]+)[\s\w]+,
Get a primary key field:
\s*PRIMARY\s+KEY\s+\(([\w_]+)\)
Get foreign keys data:
\s*FOREIGN\s+KEY\s+\(([\w_]+)\)\s+REFERENCES\s+([\w_]+)\s+\(([\w_]+)\)
You can test it here (respectively):
https://regexr.com/59251
https://regexr.com/59254
https://regexr.com/5925a
https://regexr.com/594eb
The Regex are returning results into a named captured group, you can find the name if you look here (?'GREOUP-NAME'..myregex...). It makes it easier for you to reference them after a finished regex search, it will be easier to split them.
FULL SEARCH
((?'COLUMN_NAME'(?<=^\s\s)([[:lower:]]\w+))|(?'PRIMARY_KEY'(?<=PRIMARY\sKEY\s\()(\w+))|(?'TABLE_NAME'(?<=\bTABLE\s)(\w+)))
SPLIT SEARCH
Get table name:
(?'TABLE_NAME'(?<=\bTABLE\s)(\w+))
Get primary key:
(?'PRIMARY_KEY'(?<=PRIMARY\sKEY\s\()(\w+))
Get column name: This one is a little bit sloppy and will only capture columns that are lowercase. Since your text didn't have any tabs-characters. This was the best i could do but it's a bit risky.
(?'COLUMN_NAME'(?<=^\s\s)([[:lower:]]\w+))
You can run them here, regex101, and try it out.
Be aware that the regex is dependent on whatever regex-engine your are using. There are some shortcomings regarding standards, and some regex's might need to be translated to your engine. For ex. lookbehind is not supported on all engines.

DAX - How to lookup and return a value from another table based on 2 possible lookups

I have 2 tables, one has a ton of fields so I didn't copy it all but the 2 fields in the big table that I'm working with are "Item Number" and "Item Description". The smaller table is pictured below.
ItemData table
ItemNumber
ItemDescription
Entities
ProductLines
The two tables are not related; I need to have a column in the big table named "Entity" where I lookup the item number or the item description (if the item number is missing) and return what Entity is associated. If both fields are empty then return "NONE".
My current code is below and it works sometimes which doesn't make sense because the code isn't correct, I know. I also can't get it to look at one field if the other is blank which is why that part of the code has been deleted.
Entity = LOOKUPVALUE(ItemData[Entities],ItemData[Item Number],Page1_1[Item Number],"None")
Here is what I want it to say in DAX - Entity = if itemNumber is not null then use item number to retrieve the entity name, otherwise use the itemdescription to find the entity.
Here is what I would like to see:
Item number = "123"
Item Description = "Sunshine"
Entity = "Florida"
I can pull item number and description from the big table. I just need to match those with the small table to get the entity.
You can create an if statement:
Entity = IF(ISEMPTY(ItemData[Item Number]) then
LOOKUPVALUE(ItemData[Entities],ItemData[Item Description],Page1_1[Item Description]) else
LOOKUPVALUE(ItemData[Entities],ItemData[Item Number],Page1_1[Item Number]))

How to remove/hide column names in kable?

I am plotting a table using following code but I found there is unnecessary column names V1 and V2 appear as column name.
statdat<-read.table("stat.txt",sep="\t",header=FALSE)
kable(statdat)
How can I avoid printing the column name?
You can set col.names to NULL to remove the column names:
kable(statdat, col.names = NULL)
An alternative solution is to use format="pandoc" and cat() to select the relevant rows after the table has been created. This solution is given here: R- knitr:kable - How to display table without column names?

Sitecore Name Lookup Value List - Multilpe Values per Key

Specifically in sitecore, the column configuration is defined using a Name Lookup Value List, and I want to add a colour drop down along side it so it can be applied specifically to each column as set up by the configuration. This means for each key (column ID) I want the column config as a drop down and the colour as a drop down.
If you don't want to create a custom field that will allow to do this, you should:
Create Column Specification template
Add 2 fields to this template: Column and Colour
Create items using this new template for every column you need
Instead of selecting columns in your Name Lookup Value List, select Column Specification items.