Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Monday, April 8, 2024

FileNameSplit() to slip the Directory, file name and extension in D365 FnO

 Hi,


    /// <summary>
    /// Validate the Fileformat
    /// </summary>
    /// <param name = "filepath">FilePath</param>
    /// <returns>Boolean</returns>
    public boolean validateFileExtension(str filepath)
    {
        str         actualFileName, fileExtension, actualFilePath;
        boolean     ok = true;
 
        [actualFilePath,actualFileName, fileExtension] = fileNameSplit(filePath);
 
        ok = strScan(actualFileName,allowedFileNameFormat,1,strLen(actualFileName));
        if(!ok)
        {
            Error("@SUNR:FileDoesntExisit");
        }
 
        return ok;
    }


Regards,


No comments:

Post a Comment

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...