01-17-2022 06:29 AM - last edited on 05-02-2023 10:42 AM by JackLacava
Hello Experts,
I am trying to export Cell Details to a CSV using a business rule function as shown below:
If args.CustomCalculateArgs.FunctionName.XFEqualsIgnoreCase("Export_CellDetails_CSV") Then
Dim wfUnitInfo As WorkflowUnitInfo = api.Workflow.GetWorkflowUnitInfo()
Dim SRCTimeName As String = wfUnitInfo.TimeName
Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
Dim timeStamp As DateTime = DateTime.Now '.UtcNow
Dim AESTNow = System.TimeZoneInfo.ConvertTime(timeStamp, TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time"))
Dim timeString As String = AESTNow.ToString("yyyy_MM_dd_HHmm")
Dim xfolderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp(si, True, configSettings.fileShareRootFolder, si.AppToken.AppName)
Dim csvFilePath As String = xfolderPath & "\" & "Cell_Details.csv"
If File.Exists(csvFilePath) Then
File.Delete(csvFilePath)
End If
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, csvFilePath, "E#T_Entities", "E#EB1000", "S#ACTUAL", "T#2022M3")
End If
I am using a "custom calc" DM step to trigger the Business Rule function. Cell details are as shown in the form.
The issue is: Cell_Details.csv file is getting generated in File Share folder but is empty (as shown below):
I have provided all the intersections (copied from Cell POV Information) in the DM step but not sure why the contents are not getting exported.
Has anybody faced this issue before? May be I am doing something silly. Thanks.
Regards,
Sid
Solved! Go to Solution.
01-17-2022 07:33 AM
The E# (and the S#) is only needed, if it says filter in the parameter name, I like to correct my previous statement. In the help it says:
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, serverFilePath, entityDimensionName, entityMemberFilter, scenarioName, timeMemberFilter)
This means, your code should be like this:
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, csvFilePath, "E#T_Entities", "E#EB1000", "S#ACTUAL", "T#2022M3")
=
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, csvFilePath, "T_Entities", "E#EB1000", "ACTUAL", "T#2022M3")
Is it working?
01-17-2022 07:19 AM - edited 01-17-2022 07:19 AM
The entity dim name needs no 'E#' prefix.
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, csvFilePath, "T_Entities", "E#EB1000", "S#ACTUAL", "T#2022M3")
Might already work.
01-17-2022 07:24 AM
Hi Christian,
Sorry it has E#. I didn't put it here by mistake.
01-17-2022 07:27 AM
It shouldn't that might be the problem.
01-17-2022 07:33 AM
The E# (and the S#) is only needed, if it says filter in the parameter name, I like to correct my previous statement. In the help it says:
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, serverFilePath, entityDimensionName, entityMemberFilter, scenarioName, timeMemberFilter)
This means, your code should be like this:
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, csvFilePath, "E#T_Entities", "E#EB1000", "S#ACTUAL", "T#2022M3")
=
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, csvFilePath, "T_Entities", "E#EB1000", "ACTUAL", "T#2022M3")
Is it working?
01-17-2022 08:00 AM
Hi Christian,
It worked. my mistake. Thanks 🙂
01-18-2022 11:04 PM - edited 01-18-2022 11:05 PM
Hi Christian,
The export works but gives an error: "The process cannot access the file '\\abcxyz.file.core.windows.net\onestreamsharedev1\FileShare\Applications\OneStreamDevelopment\DataManagement\Export\SiddarthRai\Cell_Details.csv' because it is being used by another process."
Do we need to close the file or kill some process to avoid this kind of error?
Thanks,
Sid
01-19-2022 04:31 AM - edited 01-19-2022 04:31 AM
I only get this error message, if the old document is still open in excel. Close excel and it will work.
This is the code I used for testing.
Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
Dim xfolderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp(si,True, configsettings.fileShareRootFolder,si.AppToken.AppName)
Dim csvFilePath As String = xfolderPath & "\" & "Cell_Details.csv"
' If File.Exists(csvFilePath) Then
' File.Delete(csvFilePath)
' End If
Dim sValue As String = BRApi.Finance.Data.ExportCellDetailToCsv(si, csvFilePath, "HoustonEntities", "E#[South Houston]", "Actual", "T#2022M3")
01-19-2022 05:36 AM - edited 01-19-2022 05:38 AM
Hi Christian,
Cell_Details.csv was closed when I was getting the error. Based on your reply I closed all other excel instances and restarted my machine to make sure there is no hung instance but still same error. As you can see below there are only 2 programs opened.
01-19-2022 06:08 AM
It is a network drive, is it possible, that other processes are blocking the file? Like a virus checker or a backup tool?
I don't think it is necessary a Onestream server problem, because I can't replicate the problems, but I work locally.
Some things you might like to test:
I hope some of this helps.
01-19-2022 07:29 AM
Hi Christian,
There might be some process blocking my export and causing error. I will ask the admin to check this. I will also add a time stamp to see if the problem goes away.
Thanks for the suggestions.