Planning Analytics

 View Only
  • 1.  [PAW] Upload folder choice functionality

    Posted 2 days ago

    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
    ------------------------------


  • 2.  RE: [PAW] Upload folder choice functionality

    Posted 18 hours ago

    Hi @Laurent Mariotte

    Indeed, this feature aimed to move a local file (user machine) into the IBM Server, and specifically inside the Model_Upload folder which is under the Data folder.
    You can use your Process TI to move this file from the standard folder (Model_Upload) into another destination folder using a command line like:

    sFile_Name = 'xxx.csv';
    sSource_File_Path = '.\Model_Upload\'|sFile_Name;
    sTarget_File_Path = '...\DimFiles\'|sFileName;
    sCmd = 'Copy /y "'|sSource_File_Path|'" "'|sTarget_File_Path|'";



    ------------------------------
    Bilal KACEL
    ------------------------------



  • 3.  RE: [PAW] Upload folder choice functionality

    Posted 18 hours ago

    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
    ------------------------------



  • 4.  RE: [PAW] Upload folder choice functionality

    Posted 18 hours ago
    Hello Rob, 

    Thank you for this detailled answer.

    I've heard that cmd function doesn't work on PAAS environment (AWS infrastructure) ?

    Do you confirm that's works on PAAS ?

    Many thanks,

    Laurent





  • 5.  RE: [PAW] Upload folder choice functionality

    Posted 18 hours ago

    Hi Laurent,

    I am PAoC non AWS, as we're running on the windows infrastructure in the background as far as I'm aware

    This is the scripting used within my current IBM Cloud Environment

    Thanks

    Rob



    ------------------------------
    Rob Wharmby
    ------------------------------