Date type convert in SSIS - csv

Data set contains some 2020-02-01T19: 43: 03 data. How can I convert this to 2020-02-01 19:43:03 in SSIS. I tried (DT_DATE), (DT_DBDATE), (DT_DBTIMESTAMP) but it didn't.
Thanks

This should be fairly simple depending on the approach you wish to take :
You can create a script transformation task in which you can apply C# String.Split function to remove the T.
You can use SQL and use a SUBSTRING function which allow you to take the first part of the data till T and the next part of the datetime from T onwards.

Related

What format does a Google Data Studio DATE field expect from the connector?

I am building a Google Data Studio connector with a field called date. The field's type is YEAR_MONTH_DAY. Now, when I return a string, for instance "2020-09-22", the field shows null as a result. What value should my connector provide to have Data Studio recognize it as a date?
"2020-09-22" is of type YEAR-MONTH-DAY, not YEAR_MONTH_DAY
Without knowing the specifics of the connector you are using:
Be careful theat your provided format matches the expected one
Read about supported Dates and times in Data Studio
If necessary, use date formatting methods like e.g. TODATE
If the DATE field you are talking about is the absolute date as mentioned here, the expected format is YYYYMMDD.
For some reason I have had to implement a workaround for this more often lately which is to create a new field in the data source and use the TODATE() function and use that new field in my dimensions on the report.
Try a formula field like:
TODATE(comp_pd_end, "%Y-%m-%d", "%Y%m%d")
The expected date format for the connector is YYYYMMDD, without any separator.
You can check the official documentation:
https://developers.google.com/datastudio/connector/reference?hl=en#semantictype

ORDA: How can I query field value against a field value?

Background
I'm converting old 4D code from class queries to ORDA queries. One thing I can't figure out is how to query with a field vs a field, rather than a field vs a value.
Edit: I'm using 4D v17.4.
Example
Classic:
Query([Customers];[Customers]State="IN")
ORDA:
ds.Customers.query("State = 'IN'")
Goal
I want to be able to query a table for results where I'm comparing a field value vs another field value. I can do it in classic querying via the following:
Query([Customers];[Customers]State#[Customers]AdministrativeRegion)
What I Tried
ds.Customers.query("State # AdministrativeRegion") // DOESN'T WORK
Question
Is this possible?
You didn't mention which version of 4D you are using. 4D is changing very rapidly these days and the difference between them can really matter, though in this case not as much.
Using placeholders in your query string is the first step.
Instead of
ds.Customers.query("State # AdministrativeRegion")
do
ds.Customers.query("State # :1 ";"some value")
Each placeholder is referenced by the :n syntax starting at 1. This is a big benefit because 4D will manage converting the comparison value data type. This is also the key to referencing a value in an entity, object, formula, etc.
$entity_selection:=ds.Customers.query("State # :1";$entity.State)
where $entity is the one you want to compare to.
I would rather use ds.Customers.query(":1";Formula(This.State#This.AdministrativeRegion))

How to read first line of the flat-file containing date value and compare with a user variable defined in 2008 SSIS package without using sript task

i want to read first line of the flat-file containing date value and compare with a user variable defined in 2008 SSIS package without using sript task.
This solution is a bit long for what the simple task you require but since you don't you want to use script task, you can try below:
Create variable to store the date value from your flat file
Create a data flow task to import the flat file into a SQL table.
Add an Execute SQL task to get the first line from the SQL table and map the result
set to the variable created at step 1.
You can now compare the variable created and the one you already have.
e.g #[User::NewVariableCreated] == #[User::ExistingVariable]
This will return a Boolean data type result of True or False depending on the values supplied.
Hope this helps.
One option is to use a Conditional Split. Within this task, a condition can then be added comparing the date column of each row with the variable. A basic example of a condition for this is below, which checks to see if the date column of each row is equivalent to or more recent than the date variable. From here, the rows be directed based off whichever condition they match.
FlatFileDateColumn >= #[User::DateVariable]

Creating a variable with month number from existing variable with the DATETIME18. informat in SAS

I am trying to something very simple but failing miserably.
Using the SAS query builder I want to create a new variable with the month number, based on an existing date variable.
An example of my variable I want to change is this:
07/01/2015 00:00
So I want to create a new variable with the number 1 in it.
My existing variable has an informat DATETIME18.
So I have tried the following:
month(t1.My_Date)
month(t1.My_Date, 'DATETIME18.')
Both of the above create a new variable but all the fields are empty.
So I thought to change the variables informat to remove the time element & then use the month function, so I tried:
MDY(t1.Issue_Date, 'DATETIME18.', 'DATEw.')
But I get the following errors:
ERROR: Function MDY requires a numeric expression as argument 2.
ERROR: Function MDY requires a numeric expression as argument 3.
Any ideas? I basically want to pull out the month number from a variable when the variable has the DATETIME18. informat.
Thanks in advance
Paul
Your variable is datetime and month() function works with dates. Use datepart() function before using month():
month(datepart(t1.My_Date))

Comparing the excel cell value while importing in spring

I am importing excel data using html, spring and apache POI API. I need to do some validations before saving the data.
For a cell, I need to check whether its value is greater than 01 and less than 32.
I have seen like
cell.getStringCellValue().matches(regex);
Using this I have reached in a solution like this
if(cell.getStringCellValue().matches("\b([1-9]|[12][0-9]|3[01])\b"))
But I have read like, using regExp for comparing numbers is not such a good Idea, it is mainly for strings.
So my question is , is there a better way to solve my problem, finding whether the cell value falls within a range.
You need to add 0 before [1-9] inorder to match the number range from 01 to 09.
\b(0[1-9]|[12][0-9]|3[01])\b