Combining three columns of text data in Google Data Studio - google-data-studio

I have a table of data like so.
Comment 1
Comment 2
Comment 3
This is a text comment
null
null
null
this text comment has a number 2
null
null
null
this is comment 3
I want to create a calculated field such that I have a column that aggregates all the data into one like so.
Combined Comment
This is a text comment
this text comment has a number 2
this is comment 3
I did read through GDS help documents about CONCAT and I found that the null values make it so CONCAT comes out null.
I had slightly better luck with a CASE statement when combining two of the columns but not all three.
I also tried to combine the two columns then used that combined column into another calculated field without luck.
All fields are set to text, many have a mix of alpha and numeric characters but should be treated as text. None are only numbers.
Any help is appreciated.

Create a new calculated field, with a nested function? The below worked on your example:
REPLACE(CONCAT(CONCAT(Comment1,Comment2),Comment3),'null','')

Related

How to add values in cells ONLY when other columns contain data from a query result

Link to example file:
https://docs.google.com/spreadsheets/d/1dCQSHWjndejkyyw-chJkBjfHgzEGYoRdXmPTNKu7ykg/edit?usp=sharing
The tab "Source data" contains the data to be used in the query on the tab "Query output". The tab "Desired result" shows what I would like the end result to look like.
The goal I'm trying to achieve is to have the formula in cell A2 on the tab "Query output" to populate the data in all four of the columns, so that it looks exactly like the "Desired result" tab. I know I can get the same result simply by entering additional formulas in C2 and D2, but this is not the objective, I need the results to come specifically from the single formula in A2.
The information in the "Additional data 1" column should simply repeat the word "Test" for every row that contains data in the first two columns. The information in the "Additional data 2" column should simply repeat the data from cell 'Source data'!A1 for every row that contains data in the first two columns.
Please feel free to edit the example file as it only contains dummy data. If you like, you can copy the tab "Query output" to create your own working formula for illustrative purposes.
EDIT:
I'm thinking along the lines of creating an array that consists of the required data for the columns "Additional data 1" and "Additional data 2" and then combining that array with the array of the query result which provides the first two columns. I've been experimenting with this in various ways, but so far the only result I have achieved is an error on the first cell of the query results. I also have no idea yet how I could make sure that the second array contains an equal amount of rows to the query result.
You can add static data into query:
=QUERY('Source data'!A3:B,"SELECT A,B, 'Test', '" & 'Source data'!A1 &"' WHERE A IS NOT NULL LABEL A '', B '', 'Test' '', '" & 'Source data'!A1 &"' ''")
Many thanks to #basic for the provided assistance! The insights were a great help to solving my issue. That said, I have muddled along a bit, and I've come up with a slightly different solution which I find better suited as it gives true blank values instead of a column filled with spaces.
First of all, instead of querying directly on the source data, I built an array and queried on that. I used the two existing columns (A and B) from the source data and added a third column to the array which does not exist in the source data. In order to make sure that the third column would consist of blank values, I used the IFERROR formula.
=IFERROR(0/0)
The formula above returns a blank because dividing by zero forces an error and the IFERROR method returns a blank unless an alternative return value is specified.
In order to be able to use this formula in an array however, it had to be tweaked slightly, because as it is it would only return a single blank cell value instead of a column of blank values. To do this, I used an already existing column from the source data, and then encapsulated it in an ARRAYFORMULA.
=ARRAYFORMULA(IFERROR('Source data'!A3:A/0))
Using this, the resulting array has the following formula.
=ARRAYFORMULA({'Source data'!A3:A,'Source data'!B3:B,IFERROR('Source data'!A3:A/0)})
This creates an array consisting of the two original columns A and B from the source data, plus an additional third column filled with blank values. This array can now be queried upon, and using the tricks previously provided by #basic the desired result as specified in the original question can be achieved.
Due to the query now being used upon a user-defined array, the columns in the SELECT statement now have to be referred to as Col1, Col2, Col3, instead of A, B, C. The final formula now looks like this.
=QUERY(ARRAYFORMULA({'Source data'!A3:A,'Source data'!B3:B,IFERROR('Source data'!A3:A/0)}),"SELECT Col1,Col2,'Test',Col3,'"&'Source data'!A1&"' WHERE Col1 IS NOT NULL LABEL 'Test' '','"&'Source data'!A1&"' ''")
I hope this information may prove of use to someone else as well.

Concatenate multiple fields on Oracle NetSuite

I would like to create a workflow to concatenate 3 diferent fields, the first and second ones are list/record's type, and the third and last one is a text field. The problem is that the first and second fields are not recognized at the formula and must be converted, and the formula doesn't work. Does anybody could help me with the correct formula to convert the first and second fields and concatenate all fields?
Note: I'm using the simple formula: concat(field1,field2,field3) and it's not working.
In NetSuite you use || to concatenate fields.
Here are two examples:
Code: {firstname}||{custentity2}||{datecreated}
Result:
Code 'Name:'||{firstname}||' Gender:'||{custentity2}||' Created:'||{datecreated}
Result:

Loop inside Pentaho Data Integration Transformation

I have a transformation as
where the text file is in the following format:
For each of the t_cmp(the number of t_cmp is not known prior) in the text file, I want to execute Read Company
But it is giving error as
Can anyone please tell me where am I going wrong?
You need to pass 3 rows, each with 1 field, instead of a single row with 3 fields.
The number of fields must match the number of parameters of your query.
So, in short, transpose your data. Either:
read line as a single field then use Split field to rows
or read as now and use Row normalizer
Both approaches should work.

Excel: Array formula to return the column data that matches multiple criteria

I would like to submit an Excel problem I tried to solve for the past few days. I am not allowed to use macro, only formulas.
I have 3 tables (see link):
The first one (purple) contain a list of employees and their initials, no duplicates;
The second one (blue) is the main database (+ 500 columns), where all the employees codes are reported and each check mark (ΓΌ) represent the specific options related to that employee; this table is always modified (employees come and go, options are added, etc.);
The third one (Green) is the table that we need to make functional; when we select the name of an employee (yellow), it returns the matching initials (orange); we would like this table to automatically search the initials of the employee in the blue table heading and return the Codes that match the check marks in the respective column; I need a particular array formula to do so.
As you can notice, I calculated various formulas tests and, although I might be on the right path, I lack the necessary skills to create a complex formula that will return the matching codes of the preferences (check marks) from the array column. Does someone have an idea what should be modified to achieve this goal ? Thank you all for any solution you can propose.
Excel file

Remove guids from ntext column

I'm trying to update a big amount of data in a customer db, but I've encountered a problem.
The column (ntext) I need to update contains a mix of regular text/comments and guid's.
I only need to update the cells that does NOT contain a GUID.
Searching for ways to determine if some text is a uniqueidentifier/guid in SQL gave multiple solutions like som regex, but for some reason that did not remove all entries of guids from the select statement. (I tried some of the solutions from here: How to check if a string is a uniqueidentifier?)
Can someone tell me how to remove all kinds of guid'like entries in the ntext column?
Any help would be much appreciated.
EDIT:
Example of guid removed correctly:
4cfb5539-1656-4447-87f7-ea7c4ea94e96
Example f guid still in the list:
f5f284a0-c1c5-4c71-95b6-1eaa3ed38222
They're the same length, I don't see any hidden characters or spaces (tried to trim with no difference) etc.
EDIT 2:
The SQL statement I used:
SELECT * from TABLE
where VALUE like
REPLACE(REPLACE('00000000-0000-0000-0000-000000000000', '0', '[0-9a-fA-F]'),' ','')
EDIT 3:
Another statement removing any whitespace as first step
SELECT * from TABLE
where REPLACE(Convert(nvarchar(max),VALUE), ' ', '') not like
REPLACE('00000000-0000-0000-0000-000000000000', '0', '[0-9a-fA-F]')
WHERE column like '%-%-%-%-%'
This filter condition will find all the rows that have a guid in the "column" column.
You could also do something more complex using PATINDEX

Resources