Why do the dates not match in this function?

Options
Nigel Light
Nigel Light Contributor
edited December 2023 in General

Hi,

We are trying to write a Function that checks to see if a valus is a date and, if so, formats it (for consistency). It then does the same for the other date and compares.
Using the parameter values below it doesn't seem to recognise them as the same date and returns a false when the dates are the same, just that the format is different.

Anything we are doing wrong?

Thanks

@Nigel Light @Pete Robson

Best Answers

  • Fatme Kungyova
    Fatme Kungyova Experian Employee
    Answer ✓
    Options

    Hi @Nigel Light, when you apply the 'Format date' function to the date its type is changed to alphanumeric, which causes the check for equality to fail since it is comparing alphanumerics instead of dates.


    You can check that by adding the 'Datatype' function before and after the 'Format date' step, which will tell you what are the types of the values.

    Here is an example:

    The results are:


  • Nigel Light
    Nigel Light Contributor
    Answer ✓
    Options

    Hi

    Thanks for getting back to me - really helpful and I think we have a solution now

    Nige

  • Faz Haq
    Faz Haq Experian Employee
    Answer ✓
    Options

    Hi Nige,

    Basically Equals only looks at the alphanumeric charaters everything else ignored. If you change "Equals" to "Equals (Strict)" you will then get the expected results.

    The "Remove white space" function removes "Space", "tab", "line feed (newline)", "carriage return", "form feed", and "vertical tab".

Answers

  • Nigel Light
    Nigel Light Contributor
    Options

    Taking this 1 step further, comparing National Insurance Number fields - the results are as required (ie ignoring case and any spaces) for the following examples, other than it matches with the inclusion of dashes in the 2nd NI No value in example 6. Matching using an "equals (strict)" gives the correct results. Is this a similar case of data type?

  • Nigel Light
    Nigel Light Contributor
    Options

    Ah… I get it.
    Thanks
    Nige