Power Query - multiple data types in one column (dates & text) - adding conditional column to break up data - powerquery

I have multiple data types in one column (dates & text) see table below - I'm wanting to add new column so that one column has date values only and the new column has the text values only.
I guess that I need to add a conditional column but I don't know the language to do it.

I found the solution here:
Basically you duplicate the column, change the column type to one of the types (I changed to date type), therefore the text changed to errors.
I then changed errors to null values.
Then I added a conditional column and substituted the null values for the values in the original column.
See link below for example:
https://www.excelguru.ca/blog/2016/11/30/extract-data-from-a-mixed-column/

Related

Why does CSVREAD not work as expected when it is supposed to read the column names from the csv file?

According to the H2 documentation for CSVREAD
If the column names are specified (a list of column names separated with the fieldSeparator), those are used, otherwise (or if they are set to NULL) the first line of the file is interpreted as the column names.
I'd expect reading the csv file
id,name,label,origin,destination,length
81,foobar,,19,11,27.4
like this
insert into route select * from csvread ('routes.csv',null,'charset=UTF-8')
would work. However, actually a JdbcSQLIntegrityConstraintViolationException is thrown, saying NULL not allowed for column "ORIGIN" and indicating error code 23502.
If I explicitly add the column names to the insert statement like so,
insert into route (id,name,label,origin,destination,length) select * from csvread ('routes.csv',null,'charset=UTF-8')
it works fine. However, I'd prefer not to repeat myself - following the DRY principle :)
Using version 2.1.212.
The CSVREAD function produces a virtual table. Its column names can be specified in parameters or in the CSV file.
INSERT command with a query doesn't map column names from this query with column names of target table, it uses their ordinal positions instead. Value from the first column of the query is inserted into first column specified in insert column list or into first column of target table if insert column list isn't specified, the second is inserted into second column, and so on.
You can omit insert column list only if your table was defined with the same columns in the same order as in the source query (is your case in the CSV file). If your table has columns declared in different order or it has some additional columns, you need to specify this list.

How to save the data in a different column instead of replacing the data in same column

I have one field on my form (field example name "completion_date"). This data is stored to table column "completion_date". When users edits the detail, data is overwritten in the backend table field as a default way of storing the data. How can I pass on the existing data in this column to a new column (completion_date_a) when the user saves a new date in the field.
One option is to create a database trigger, e.g.
create or replace trigger trg_bu_date
before update on your_table
for each row
begin
:new.completion_date_a := :old.completion_date;
end;
/
Littlefoots' answer is correct, but you could also do this in apex with very little work. Suppose your form items are P1_COMPLETION_DATE and P1_COMPLETION_DATE_A, both mapped to their respective database column. P1_COMPLETION_DATE_A is hidden. Add a computation to P1_COMPLETION_DATE_A with point "After Header" and type "Item". Pick P1_COMPLETION_DATE as item.
Now when you save the form, the value of P1_COMPLETION_DATE_A will be set to the value of P1_COMPLETION_DATE when it was selected.

Comparison of Multiple column of single row in Informatica

I have a requirement in Informatica powercenter development, where I need to populate a column after multiple column Compaeisons
Like for ex - we have Brand name in 30 Columns of same row, I have to populate a field in target table based on all these 30 Columns, if all the 30 Brands are equal then only we have to populate the Brand name else I have to populate Brand do not match.
also there may be case that some brands fields are are null but we do not have to compare that with not null Brands.
Either use a DECODE function with OR, or do an MD5 on concatenation of all your columns and compare the result.

Delete columns from BIRT report

I have a BIRT Excel Report with 10 columns. I have a query which executes and brings the data for all the 10 columns.
However, based on one of the input parameters, i need to display just 8 columns. I am able to hide the remaining 2 columns but i would like to delete those 2 columns from the report so that user does not see the hidden columns.
I tried to change the query but i am unable to dynamically set the select parameters.
Is there a way either in Query or in BIRT to remove few columns based on an input condition.
You cannot delete the columns, but it's sufficient to hide them dynamically using the column's visibility expression. You can add an aggregation to the table, using the MAX function for the column data (let's call it max_name).
E.g. if your table column shows the DS column NAME and you want to hide the column if NAME is empty for all rows:
Add an aggration (let's call it MAX_NAME) to the table, with the aggregation function MAX and the expression NAME. Then in the visibility expression of the table column, use !row["MAX_NAME"] as the expression.
After drag and drop the dataset. Right click on column header and select the delete column option.

Selecting only check marked rows in a different table - Mac Numbers

I have a table in Mac Numbers which has a column with checkbox. I am trying to copy only those rows in a second table which are check marked.
I also want to extend this solution to multiple tables; I will have multiple tables having a column with checkbox. I want to copy all those rows into a single table which are check marked.
I tried with LOOPUP function but it didn't help.
How can we do this?
I worked it out in 2 steps -
Used IF condition to put column data if checkbox is checked else put "NA".
Then put a filter on the new table to filter out all rows which has that column with values "NA".

Resources