Datefield recognized as text

Is there a way to view the faulty date which is actually seen as text? Because I can't just check them all by hand.

Thanks in advance

Comments

  • GrantSmith
    GrantSmith Indiana 🔴

    Hi @user046467 

    You could spin up a magic ETL and attempt to convert the data type to a date (using Alter Columns tile in Magic 2.0 or Data Type(?) in 1.0). When you run the preview it'll state which value it wasn't able to convert to a date.

     

    Alternatively you could utilize a replace text field with a regular expression to change the text to a value if it passes and filter for rows which don't have the set value.

     

    A simpler (but maybe less reliable) check would be to check to see if the length of your field is 10 characters or not (assuming YYYY-MM-DD type format - 8 digits, 2 separator characters) in a beast mode on a table card and then filter for records which don't have 10 digits.

  • jaeW_at_Onyx
    jaeW_at_Onyx Budapest / Portland, OR 🟤

    as an extension to @GrantSmith 's idea, 

     

    on your input tile in Magic 2.0 you can set the desired data type (instead of using an ALTER tile).  you can also build in error handling that says 'if the column cannot be converted to date replace with a NULL value.  You could then output rows where the date column is NULL as a dataset.  

     

    it's a bit of a pain to have a dataset with a null date column, so maybe add a ROW_ID so you at least know which row of your raw dataset it was.  

     

    i like your regex idea Grant!  except i hate regex with a passion ?