Hi,
I do this by using the file upload part of the action buttons on the workbooks
I have a process where I feed in the file to be uploaded (that is the one you tie the action too) and then the name I want that file to have and the location I want the file to end up in. For me the default action of the button would put things in model_upload which is accessible to most people within the environment, so I have a TI manage it for me
Parameters:
pFileName - Name of File Uploaded
pNewName - New Name of File
Script:
If(pFileName @= pNewName);
Else;
# Create the path for the Output files (the Powershell and Text file)
vDevice = 'S:';
vFilePath = '\prod\xxx\Data\model_upload\';
# Create a unique file name i.e., Process name + date & time in yymmddhhmmss format
vFileProcessID = 'ps_fileprocess';
vFileUniqueID = TIMST (Now(), '\y\m\d\h\i\s');
# Create the Powershell Script filename
vFileType = '.ps1';
vfile=vDevice | vFilePath | 'ps_automation\' | vFileProcessID | '-' | vFileUniqueID | vFileType;
# Create the 3-line PowerShell script in a uniquely identified file using multiple 'echo' commands
vCommandLine = 'cmd /c "echo >> ' | vfile | ' & ' |
#'echo ' | pFilename | ' >> ' | vfile | ' & ' |
'echo Remove-Item "' | vFilePath | pNewname | '" >> ' | vfile | ' & ' |
'echo Rename-Item -Path "' | vFilePath | pFilename | '" -NewName "' | pNewname | '" >> ' | vfile | ' & ' |
'echo ' | 'exit' | ' >> ' | vfile;
ExecuteCommand ( vCommandLine, 1 ) ;
# Run the Powershell Script
vCommandLine = 'cmd /c ' | 'Powershell ' | vfile;
ExecuteCommand (vCommandLine,1) ;
# Delete the Powershell Script
vCommandLine = 'cmd /c del /Q ' | vfile;
ExecuteCommand (vCommandLine,1);
EndIf;
This will create a powershell script on the fly for you 9I do have a control folder in my data folder called "ps_automation" which is where any ps scripts create themselves.... it means if a process bugs out you can easily remove the scripts.... the scripts delete as part of the process, so you don't need to worry about that step
You define the folder which the files will be moved too as the path from the data folder as the root and it should all work for you
Hope this helps
Rob
------------------------------
Rob Wharmby
------------------------------
Original Message:
Sent: Mon December 02, 2024 10:49 AM
From: Laurent Mariotte
Subject: [PAW] Upload folder choice functionality
Hello IBM Community,
From a PAAS environment, I have created some folders (dim, data,...) and i would like to let users upload there files in the dedicated folder from a TI Button.
For instance we should be able to push a dim file into ../DimFiles/xxx.csv. For now we can only upload to the root folder.
So i would like to know if there is a workaround in PAAS (like an automatic moving files) until we can get this kind of functionality in a next release ?
Many thanks,
Laurent
------------------------------
Laurent Mariotte
------------------------------