We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Cast type in db

ImenMersani
7 - Meteor

Hello,

 

i'm using in db tools to convert the type of some fields (for exemple from V_string to date) and i have to generate 2 files

if the conversion is ok then the records will be saved in the first file

if the conversion is not ok the records will be saved in the second file(like a log file)

 

is there any suggestion ?

 

thank you :) 

 

2 REPLIES 2
RolandSchubert
16 - Nebula
16 - Nebula

Hi @ImenMersani ,

 

if I got you right, you want to split data by "convertible to date" and "not convertible to date". If you are using SQL server, an approach could be to use the TRY_CAST function:

 

2022-03-10_15-17-02.jpg

 

Depending on the result of TRY_CAST, the field is converted (or is not). You can use that additional field (containing a date, if conversion is possible, otherwise it's NULL) to split.

 

What do you think?

 

Best, 

 

Roland

apathetichell
20 - Arcturus

Use REGEXP in an In-DB filter to test if your string matches your characteristics you are looking for in a date. Have your formula tool after your filter to cast to date only the good entries.

Labels
Top Solution Authors