Files manipulation on SFTP Location
I need to move some files around the various folders on our SFTP server and I am trying to do it via the Extender BR. Basically I need to move the files from the staging folder into various other folders based on the file names. The rule below compiles successfully. When executed, I get the exception on the second pass ("Chase" related) but no files are being moved anywhere. I am stumped at the moment and would appreciate any suggestions. Thank you in advance. Yan Public Class MainClass Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object Try 'Set up SFTP connection session options Dim sessionOptions As New sessionOptions With sessionOptions .Protocol = Protocol.Sftp .HostName = "xxxxxxxxxx.xxxxx.com" .UserName = "XXXXXXX" .Password = "xxxXXxxxXXXXXx" .SshHostKeyFingerprint = "ssh-rsaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpNuL5H42WiDJY=" End With 'Use Session Using session As New Session 'Connect session.Open(sessionOptions) Dim transferOptions As New TransferOptions transferOptions.TransferMode = TransferMode.Binary Dim baiDirLocation As String = session.HomePath & "/test/TXM/BAI/" Dim remoteFiles As RemoteDirectoryInfo = session.ListDirectory(baiDirLocation) Dim results As TransferOperationResult Dim fileNumber As Integer = 0 For Each x As RemoteFileInfo In remoteFiles.Files Dim newName As String = Nothing If x.Name.Contains("Mizuho") Then results = session.PutFiles(baiDirLocation & x.Name, baiDirLocation & "Mizuho/" & x.Name, False, TransferOptions) If Not results.IsSuccess Then Throw New Exception("The file transfer from SFTP to OneStream harvest failed 1.") End If ElseIf x.Name.Contains("Chase") Then results = session.PutFiles(baiDirLocation & x.Name, baiDirLocation & "Chase/" & x.Name, False, TransferOptions) If Not results.IsSuccess Then Throw New Exception("The file transfer from SFTP to OneStream harvest failed 2.") End If 'Nothing End If 'Move or Remove Files or Move SFTP files to archive 'Session.RemoveFiles(glDirLocation & "S4iiisubdata_US50.txt") fileNumber += 1 Next 'Next Ends the Loop End Using 'Setup email distribution list When files are present Dim distributionList As New List(Of String) distributionList.Add("yyy.yyyyyyy@yyyyy.com,xxx.xxxxxxx@xxxxx.com") 'Calls email Sub Routine 'EmailNotification(batchinfo, si, distributionList) Return Nothing Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function End ClassSolved37Views0likes4CommentsNeed physical path to file
I am implementing a BR that pulls a file from FTP. The file is encrypted so I need to decrypt it using a third party library. In order to decrypt it, I need to pass in a physical path to the PGP key provided. I uploaded the key to the Public folder share for now but cannot seem to find a way to get the actual physical file. Does anyone know if uploading a file to the share folder results in an actual file being created on the server or is it just stored as a BLOB in the database?Solved4.9KViews0likes10CommentsBusiness Rule for SFTP
Hi - we're trying to PULL files from an SFTP server. These will be used for our OneStream load. Are there any sample BRs that we can reference to facilitate the file transfer from the SFTP server to OneStream? Are there libraries readily available in OS for this? So far, we have completed the following. 1. Whitelisting of OS IP from SFTP Server 2. Received SFTP server and credentials needed Thanks!4.4KViews0likes8CommentsEncryptText And DecryptText Replacement
Does anyone know what replaces the 2 utility commands below? I get a warning message that those commands are obsolete but it does not give any indication or hints of what the new commands are or what's currently available? BrApi.Utilities.EncryptText andBrApi.Utilities.DecryptText Any help is highly appreciated. Thanks, JunSolvedHow to copy a scenario from one application to another?
Hello, I recently recovered a scenario from a restored application copy from a point in time. I now would like to extract that scenario from the application copy and put that in our working application. Does anyone have any idea on how this would be done? Thank you, Jeremy MorganSolved1.6KViews0likes6CommentsImporting a CSV file from from Documents/Public/xyz folder to OneStream Cube
Hi, I have a requirement to import a Cell Details CSV file into OS. My questions are as below: 1. Can we import a CSV file from Documents/Public/xyz folder to OneStream Cube? I tried it but it didn't worked. However, I was able to import the CSV from File Share folder. 2. To achieve above, I was trying to copy the CSV file from Documents/Public/xyz folder to File Share folder but I am getting an error "Part of the path cannot be found" (SRC Path: Documents/Public/xyz folder). Error: Here is the code to copy a CSV file from Documents/Public/xyz folder to File Share folder: If args.CustomCalculateArgs.FunctionName.XFEqualsIgnoreCase("Move_File_from_Public_to_FS_Folder") Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si) Dim xfolderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp( _ si,True, configsettings.fileShareRootFolder,si.AppToken.AppName) Dim DestinationPath As String = "Cell_Details" Dim ParentPath As String = "Documents/Public" Dim fileToMove As String = "Cell_Details.csv" Dim folderPath As String = BRApi.FileSystem.GetFolder( _ si, FileSystemLocation.ApplicationDatabase, ParentPath & "/" & DestinationPath).XFFolder.FullName brapi.ErrorLog.LogMessage(si, "folderPath:" & folderPath) 'File.Copy(Path.Combine(folderPath & "/" & "Cell_Details.csv"), _ ' Path.Combine(xfolderPath & "/" & "Cell_Details.csv"), True) <--- TRIED THIS COMMAND AS WELL BUT GOT THE SAME ERROR Dim fileBytes As Byte() = File.ReadAllBytes(folderPath & "/" & fileToMove) Using dbConnApp As DBConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si) Dim dbFileInfo As New XFFileInfo( _ FileSystemLocation.ApplicationDatabase, fileToMove, xfolderPath, XFFileType.Unknown) dbFileInfo.ContentFileContainsData = True dbFileInfo.ContentFileExtension = dbFileInfo.Extension Dim dbFile As New XFFile(dbFileInfo, String.Empty, fileBytes) BRApi.FileSystem.InsertOrUpdateFile(si, dbFile) End Using End If Below code is working which copies CSV file from File Share folder to Public folder: If args.CustomCalculateArgs.FunctionName.XFEqualsIgnoreCase("Move_File_from_FS_to_Public_Folder") Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si) Dim xfolderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp( _ si,True, configsettings.fileShareRootFolder,si.AppToken.AppName) Dim DestinationPath As String = "Cell_Details" Dim ParentPath As String = "Documents/Public" Dim fileToMove As String = "Cell_Details.csv" Dim fileBytes As Byte() = File.ReadAllBytes(xfolderPath & "/" & fileToMove) Dim targetDir As String = BRApi.FileSystem.GetFolder(si, _ FileSystemLocation.ApplicationDatabase, ParentPath & "/" & DestinationPath).XFFolder.FullName Using dbConnApp As DBConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si) Dim dbFileInfo As New XFFileInfo( _ FileSystemLocation.ApplicationDatabase, fileToMove, targetDir, XFFileType.Unknown) dbFileInfo.ContentFileContainsData = True dbFileInfo.ContentFileExtension = dbFileInfo.Extension Dim dbFile As New XFFile(dbFileInfo, String.Empty, fileBytes) BRApi.FileSystem.InsertOrUpdateFile(si, dbFile) End Using End If Appreciate any help. Thanks, SidSolved3.4KViews0likes3CommentsWhere are file attachments stored after attaching them to a Reconciliation?
When we attach a file to a Reconciliation, where is the file stored and how is it stored? It it stored in the application database as a BLOB or on the application server in the file system? Is it encrypted?Solved968Views0likes2CommentsFile Explorer Incoming workflow folders missing in copied applications
This post is to provide information about File Explorer Incoming workflow folders. Based on what we've seen in our environments, when an application is copied, the new application does not contain the folder structure located at: \File Share\Applications\<Application Name>\Incoming\<Cube Root Name>_Cube\<Workflow Base Input Name>\<Workflow Import Name> We noticed these folders were missing in our last application copy when we were trying to copy files through SIC and drop them into the workflow import folders since our requirement was to drop them there for users to manually import when they choose (instead of automatically loading the files through batch import from batch harvest). To fix this issue we exported the Workflows and re-imported them back into the copied application. This triggered OneStream to create the cube root folders and workflow folders for the workflows that were imported. Hope this helps someone else who might be running into the same issue.1.4KViews1like5Comments