Hello @vishweshpatil ,
The problem is in your pr_Download procedure. It seems like you copy-pasted the below codeblock from some other project -
pro::RetrieveFileFromCentralStorage(
storagePath : sp_PublicDataExchangeFilename,
localPath : sp_FileProcessSpecificFileName) ;
Few comments regarding having this codeblock:
- This function retrieves a file from the PRO central storage and thus will work only when running from AIMMS PRO or Cloud.
- It does not fit in the workflow that you’re trying to achieve. If you want to simply download the “Output.xlsx” then you don’t need this function. You are generating the Output.xlsx file in the AIMMS project itself and thus it is right there. It is not present in the PRO central storage for you to retrieve.
- It is good to enclose these functions in an IF block using ProjectDeveloperMode() or pro::GetPROEndpoint. See Develop Multi-Platform Applications — AIMMS How-To
Modify your pr_Download procedure as below and it will work (on Cloud too). Reference documentation is here: Download Widget — AIMMS Documentation
Block
FileLocation := "Output.xlsx";
sp_FileProcessSpecificFileName := webui::GetIOFilePath(FileLocation);
if not ProjectDeveloperMode() then
! you need to copy the file to sp_FileProcessSpecificFileName only when its on PRO
! when in developer mode, you create the FileLocation to be in the root folder of the project
FileCopy(FileLocation, sp_FileProcessSpecificFileName, 1);
! pro::RetrieveFileFromCentralStorage(
! storagePath : sp_PublicDataExchangeFilename,
! localPath : sp_FileProcessSpecificFileName) ;
endif;
if fileexists(sp_FileProcessSpecificFileName) then
StatusCode := webui::ReturnStatusCode('CREATED');
StatusDescription := "Nice.";
endif;
OnError err Do
StatusCode := webui::ReturnStatusCode('ERROR');
StatusDescription := "Oops: " + errh::Message(err) ;
errh::MarkAsHandled(err);
break ; ! Trick to reporting one error.
EndBlock ;