Hi Community,Â
I am trying to use the AIMMS RegexReplace function to trim the folder path and keep the data case name. It’s working fine locally but it’s not working when testing in the server.
My code looks like this:
       block ! Get the full path for the Active Case File
           _sp_ActiveCasePathName := FormatString("%s", CaseFileURL(CurrentCase));
           !Check for server vs local. Local path won't likely contain the string 'PRO:/PublicDta'
           !example server path: PRO:/PublicData/Cases/spot_fw
           _bp_IndicateLocalFileName := not (RegexSearch(_sp_ActiveCasePathName,     "PRO:\\\\PublicData"));
           ! Text example _sp_ActiveCaseName := "C:\GitHub\spot-fw\Model Folder\data\DataCase_C5AgeTest_Output.data"
           ! This Removes the structureÂ
           !local: C:\\Location_of_File\With general\ideas-of-how\afilesnamewouldbe\Â
           !in the server: pro:/PublicData/Cases/FW SPOT Testing/
           !before the actual file name
           if _bp_IndicateLocalFileName then
               _sp_ActiveCaseName := RegexReplace(_sp_ActiveCasePathName, "C\\:\\\\(<\\-\\_\\ p:alnum:]]+\\\\)+", "");
           else
               _sp_ActiveCaseName := RegexReplace(_sp_ActiveCasePathName, ""Pp]
       endblock;
       block ! Get the full path for the Active Case File
           _sp_ActiveCasePathName := FormatString("%s", CaseFileURL(CurrentCase));
           !Check for server vs local. Local path won't likely contain the string 'PRO:/PublicDta'
           !example server path: PRO:/PublicData/Cases/spot_fw
           _bp_IndicateLocalFileName := not (RegexSearch(_sp_ActiveCasePathName, "PRO:\\\\PublicData"));
           ! Text example _sp_ActiveCaseName := "C:\GitHub\spot-fw\Model Folder\data\DataCase_C5AgeTest_Output.data"
           ! This Removes the structureÂ
           !local: C:\\Location_of_File\With general\ideas-of-how\afilesnamewouldbe\Â
           !in the server: pro:/PublicData/Cases/FW SPOT Testing/
           !before the actual file name
           if _bp_IndicateLocalFileName then
               _sp_ActiveCaseName := RegexReplace(_sp_ActiveCasePathName, "C\\:\\\\(n\\-\\_\\ e:alnum:]]+\\\\)+", "");
           else
               _sp_ActiveCaseName := RegexReplace(_sp_ActiveCasePathName, "aPp]aRr]iOo]\\:\\\\(/\\-\\_\\ Â:alnum:]]+\\\\)+", "");
           endif;
       endblock;
Â
Any ideas/help on what might be going wrong with the server file structure?
Â
Thanks in advance!