Skip to main content
April 30, 2024

Can we get WorkFlow Status Method Query?

  • April 30, 2024
  • 3 replies
  • 0 views

Is there a way to get Workflow Status Method Query, I have requirement to modify the Profile Name in the output to include Description along with Profile Name.

3 replies

April 30, 2024

Hi vignesh to get the syntax for any method query in OneStream you simply need to (1) Create a data adapter, (2) Set the Command Type to Method and (3) Set the Method Type to WorkflowStatus (as per your request).

When you try and run it it will give you an error that tells you what the syntax is for each method type (see example below)

WorkflowStatus Example: {MyWorkflowProfileName}{Actual}{2015M1}{AllProfiles}{Descendants}{Empty String or Filter Expression}.


sameburn_0-1714478291681.png

Hope this helps

vigneshAuthor
April 30, 2024

Hi, Thanks for your response. I am looking for the backend SQL Query/Code that gets executed when this Method Query is run. I have requirement to modify the some values in the default output that we get. If I get how this is being executed in the backend I will check if it can be modified to achieve what i need.

April 30, 2024

I would consider modifying the datatable result that you get from running the method query in my last post as the path of least resistance to achieve desired results for your requirement.  

April 30, 2024

vignesh  - The below Code provide you the WF Status in the Grid View. It is a Dashboard Extender Rule. with Parameters.  I created the Data Table and populating he output of method query and return to the data Grid. You can create an adapter and call the BR.

 


Krishna_0-1714491286475.png

 

If args.DataSetName.XFEqualsIgnoreCase("MyDataSet") Then

							Using dbConnApp As DBConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
							
							'Create Tables in Memory
							        Dim WFTable As DataTable = New DataTable("WFSTATUS")
        							WFTable.Columns.Add("ProfileName")
        							WFTable.Columns.Add("ScenarioName")
									WFTable.Columns.Add("TimeName")
									WFTable.Columns.Add("StatusText")
									WFTable.Columns.Add("LastExecutedStepStatus")
									WFTable.Columns.Add("LastExecutedStepTimeUTC")
									WFTable.Columns.Add("LastExecutedStepTimeEST")
							
							Dim WFTime As String = args.NameValuePairs("ParamYear")
							Dim WFScenario As String = args.NameValuePairs("ParamScr")
							Dim WFName As String = args.NameValuePairs("ParamName")
							Dim methodTypeId As String = XFCommandMethodTypeId.WorkflowStatus
							'Dim methodQuery As String = "{Total Corporate}{Actual}{" & WFTime & "}{Import Status}{Descendants}{Type ='InputImportChild'}"
							Dim methodQuery As String = "{" & WFName &"}{" & WFScenario & "}{" & WFTime & "}{Import Status}{Descendants}{Type ='InputImportChild'}"
							Dim resultDataTableName As String = "WFSTATUS"
							Dim customSubVars As New Dictionary(Of String, String)
							customSubVars.Add("Name","")
							customSubVars.Add("Value","")
							

							Dim objDataSet As DataSet = BRApi.Database.ExecuteMethodCommand(dbConnApp,methodTypeId,methodQuery, resultDataTableName,customSubVars)
  								   For Each Row As DataRow In objDataSet.Tables("WFSTATUS").Rows
									 Dim easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")
									 Dim EST = TimeZoneInfo.ConvertTimeFromUtc(Row.Item("LastExecutedStepTime"), easternZone)
   								     WFTable.Rows.Add(Row.Item("ProfileName"),Row.Item("ScenarioName"),Row.Item("TimeName"),Row.Item("StatusText"),Row.Item("LastExecutedStepStatus"),Row.Item("LastExecutedStepTime"),EST)
				                   Next 
									Return WFTable
							 
						End Using
							
						End If

 

July 3, 2024

Is it possible to get the user name who certified the workflow? This information does not appear to be in the method query table.