Forum Discussion
Error message : Expression.Error
- 9 months ago
The result I got without the error message I obtained by editing the _ValidateAge function. I pointed out the problem with what you sent me in a previous message. However, the result is not correct as none of the emails were properly validated. You will have to correct that.
The _ValidateAge method that I used is was to just check the ages to ensure that they are a integer.
(data as nullable text) as logical => let isValid = (try Int64.From(data))[HasError]=false in isValidBut you are going to have to edit your _ValidateEmail function as it is returning an incorrect result
Sorry, my English isn't very good, so I sometimes have trouble understanding or explaining myself.
How do you get the final result without any mistakes ?
Could you please post the corrected file ?
This exercise is quite complex and I'm having trouble understanding it 😊.
Thanks in advance
Best regards
The result I got without the error message I obtained by editing the _ValidateAge function. I pointed out the problem with what you sent me in a previous message. However, the result is not correct as none of the emails were properly validated. You will have to correct that.
The _ValidateAge method that I used is was to just check the ages to ensure that they are a integer.
(data as nullable text) as logical =>
let
isValid = (try Int64.From(data))[HasError]=false
in
isValid
But you are going to have to edit your _ValidateEmail function as it is returning an incorrect result
- Mederic9 months ago
Post Patron
Hello ronrsnfld ,
Thank you for correcting the code for age.
I finally understood what was expected for each of the three criteria.
For the email verification, I asked Claude.AI, who suggested the code below.
I now get the same result as in the statement (file).
But it's a strange lesson when I realise that everything wasn't correct or complete.Thank you.
Best regards(email as nullable text) as logical => let isValid = if email <> null and Text.Contains(email, "@") and Text.Contains(email, ".") and Text.Length(email) - Text.Length(Text.Replace(email, "@", "")) = 1 and Text.PositionOf(email, "@") > 0 and Text.PositionOf(email, ".", Occurrence.Last) > Text.PositionOf(email, "@") and Text.PositionOf(email, ".", Occurrence.Last) < Text.Length(email) - 2 and not Text.StartsWith(email, "@") and not Text.EndsWith(email, ".") and not Text.Contains(email, "..") and not Text.Contains(email, "@.") then true else false in isValid