extract incident number

 IncidentNumber = 

if Text.Contains([RTSK Worknote], "incomplete") then 

    "Not found" 

else 

    let

        TextToSearch = Text.Middle([RTSK Worknote], Text.PositionOf([RTSK Worknote], "INC"), 13),

        IsValidIncident = Text.StartsWith(TextToSearch, "INC") and Text.Length(TextToSearch) = 13 and Value.Is(Text.ToNumber(Text.End(TextToSearch, 10)), type number)

    in

        if IsValidIncident then TextToSearch else "Not found"


No comments

Theme images by tjasam. Powered by Blogger.