Skip to main content
January 27, 2025
Solved

How to validate invalid Date format in Appian for Date columns

  • January 27, 2025
  • 5 replies
  • 0 views

Hi All,

We have a requirement, where we have to import excel file data into Appian database stage table. Once data is loaded into stage table we have to validate the date format for date columns whether the date is invalid or valid using query entity or any custom function. In-valid records should be removed and only valid records be there. Can someone help us with this kind of scenario in Appian how we can avoid the in-valid date rows in Appian. 

Regards,

Dheeraj G

    Best answer by karumurua531442

    hi [mention:87cd6f8bfe7542fd95d4a35c3f454678:e9ed411860ed4f2ba0265705b8793d05]  you can have some SP to check and update your date format after once pushing the data into a staging table.
    example code snippet:

    UPDATE staging_table
    SET is_valid_date = CASE 
      WHEN STR_TO_DATE(date_column, '%Y-%m-%d') IS NOT NULL THEN 1
      ELSE 0
    END;
    

    5 replies

    davidj137213
    January 27, 2025

    There are severl ways to do this.. you can create en expression rule in order to validate date values and use it when importing th data, or once imported and before load it in the interface...

    karumurua531442
    January 27, 2025

    hi [mention:87cd6f8bfe7542fd95d4a35c3f454678:e9ed411860ed4f2ba0265705b8793d05]  you can have some SP to check and update your date format after once pushing the data into a staging table.
    example code snippet:

    UPDATE staging_table
    SET is_valid_date = CASE 
      WHEN STR_TO_DATE(date_column, '%Y-%m-%d') IS NOT NULL THEN 1
      ELSE 0
    END;
    

    January 29, 2025

    Hi Abhishek,

    Thank you for your suggestion, If the date is Invalid then only it should be flagged as 0, it should not update the rows which has existing null value.

    mathieud0001
    January 27, 2025

    Another method that does not require a stored proc would simply to have a process that reads the staging table in batches and then either updates the staging table or inserts the valid rows into another table.

    January 28, 2025

    I will verify the alternative method as well