SQL Declarations in Data Adapter
Source: Migrated from Champions Hello all, I’m creating a Data Adapter that is using SQL to poll an external database. I can get it to work when I’m just supplying the strings for dates. However, I wanted to get fancy and be able to parse the effective dates using variables. When I go to an online SQL tester (https://www.w3schools.com/sql/trysqlserver.asp?filename=trysql_func_sqlserver_left), I can get the below code to return ‘121181’, which is the Julian date I need in querying JDE. But the OS SQL Query returns an error saying ‘int’ is an invalid token. does anyone know if there’s a way to use variables in this way? Declare @YearRun int Declare @YearPart int Declare @MonthRun int Declare @Global varchar(100) Declare @GetTime datetime Declare @RunTime varchar(100) Set @Global = ‘2021M6’ set @YearRun = LEFT(@Global, 4) Set @YearPart = Right(@YearRun,2) set @MonthRun = Right(@Global, Len(@Global)-CHARINDEX(‘M’,@Global)) Set @GetTime = EOMONTH(CONCAT(@MonthRun, ‘/’, 1, ‘/’, @YearRun)) Set @RunTime = CONCAT(‘1’,@yearpart, DATENAME(dayofyear , @gettime)) Select @RunTimeSolved6.6KViews0likes7CommentsRESTAPI from HCM Cloud
Hi - I have created a routine in Connector Rule to fetch the Worker data from HCM and I was able to assign it to a variables and able to print it successfully. My question is below 1. How I can assign the variables to the List because I am trying to use this connector rule in Data Source and trying to bring the data to the OS stage Area ? is it possible, My function return type is task for the RESTAPI call. 2. Or I can create a Extender Rule and create a Table in the Backend and import into the table and create an another connector rule to bring it to the stage. Any suggestion would be appreciated. Thanks Krishna6KViews0likes17CommentsData source Connector - Nested Drill back
Hi, I am trying to build a Drill back functionality in one of data source connector business rules. I tried looking into One Stream reference guide on Data Source connector business rules and I found below reference for nested Drill back functionality. But practically when I tried to drill back on a drill back detail row, OS returns following message. The click on the drill back is not even calling the connector business rules any more. Can someone help me with the ways to code with nested drill backs. I tried to follow the examples from Golfstream application. Private Function GetDrillBackTypeList(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As List(Of DrillBackTypeInfo) Try 'Create the SQL Statement Dim drillTypes As New List(Of DrillBackTypeInfo) If args.DrillCode.Equals(StageConstants.TransformationGeneral.DrillCodeDefaultValue, StringComparison.InvariantCultureIgnoreCase) Then 'Source GL Drill Down drillTypes.Add(New DrillBackTypeInfo(ConnectorDrillBackDisplayTypes.FileShareFile, New NameAndDesc("InvoiceDocument", "Invoice Document"))) drillTypes.Add(New DrillBackTypeInfo(ConnectorDrillBackDisplayTypes.DataGrid, New NameAndDesc("MaterialTypeDetail", "Material Type Detail"))) ElseIf args.DrillCode.Equals("BOMDetail", StringComparison.InvariantCultureIgnoreCase) Then 'Material Type Drill Down drillTypes.Add(New DrillBackTypeInfo(ConnectorDrillBackDisplayTypes.DataGrid, New NameAndDesc("MaterialAllProducts", "Material All Products"))) drillTypes.Add(New DrillBackTypeInfo(ConnectorDrillBackDisplayTypes.DataGrid, New NameAndDesc("MaterialAllVendors", "Material All Vendors"))) End If Return drillTypes Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function 'Execute specific drill back type Private Function GetDrillBack(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs, ByVal connectionString As String) As DrillBackResultInfo Try If args.DrillBackType.NameAndDescription.Name.Equals("InvoiceDocument", StringComparison.InvariantCultureIgnoreCase) Then 'Level 1: Show FileShare File Dim drillBackInfo As New DrillBackResultInfo drillBackInfo.DisplayType = ConnectorDrillBackDisplayTypes.FileShareFile drillBackInfo.DocumentPath = Me.GetDrillBackDocPath_L1(si, globals, api, args) Return drillBackInfo ElseIf args.DrillBackType.NameAndDescription.Name.Equals("MaterialTypeDetail", StringComparison.InvariantCultureIgnoreCase) Then 'Level 1: Return Drill Back Detail Dim drillBackSQL As String = GetDrillBackSQL_L1(si, globals, api, args) Dim drillBackInfo As New DrillBackResultInfo drillBackInfo.DisplayType = ConnectorDrillBackDisplayTypes.DataGrid drillBackInfo.DataTable = api.Parser.GetXFDataTableForSQLQuery(si, DbProviderType.OLEDB, connectionString, True, drillBackSQL, False, args.PageSize, args.PageNumber) Return drillBackInfo ElseIf args.DrillBackType.NameAndDescription.Name.Equals("MaterialAllProducts", StringComparison.InvariantCultureIgnoreCase) Then 'Level 1: Return Drill Back Detail Dim drillBackSQL As String = GetDrillBackSQL_L2(si, globals, api, args, True, False) Dim drillBackInfo As New DrillBackResultInfo drillBackInfo.DisplayType = ConnectorDrillBackDisplayTypes.DataGrid drillBackInfo.DataTable = api.Parser.GetXFDataTableForSQLQuery(si, DbProviderType.OLEDB, connectionString, True, drillBackSQL, False, args.PageSize, args.PageNumber) Return drillBackInfo ElseIf args.DrillBackType.NameAndDescription.Name.Equals("MaterialAllVendors", StringComparison.InvariantCultureIgnoreCase) Then 'Level 1: Return Drill Back Detail Dim drillBackSQL As String = GetDrillBackSQL_L2(si, globals, api, args, False, True) Dim drillBackInfo As New DrillBackResultInfo drillBackInfo.DisplayType = ConnectorDrillBackDisplayTypes.DataGrid drillBackInfo.DataTable = api.Parser.GetXFDataTableForSQLQuery(si, DbProviderType.OLEDB, connectionString, True, drillBackSQL, False, args.PageSize, args.PageNumber) Return drillBackInfo Else Return Nothing End If Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function Thanks, Mohan Alluri.Solved4.5KViews0likes12CommentsNew Syntax for LookupRowFieldValue()
Summary Is there any documentation and/or sample code showing how to use the new "dbWheres" argument in a LookupRowFieldValue() function? Detail In version 6.8 (maybe earlier), if you use .LookupRowFieldValue() with your criteriaExpression (i.e. - your where clause) as a string you get a warning that this syntax is obsolete. It still runs, but obviously we shouldn't use it going forward. So, something like this now throws an warning: .LookupRowFieldValue(si, dbLocation, tableName, criteriaExpression, fieldToReturn, defaultValue) .LookupRowFieldValue(si, dbLocation.Framework, "SecUser", Name = 'Phil Brosnan', "Email", String.Empty) OneStream wants you to use a new Syntax that replaces the criteriaExpression with a list of where clauses in a dbWheres object. .LookupRowFieldValue(si, dbLocation, tableName, dbWheres, fieldToReturn, defaultValue) Unfortunately, there is no documentation or examples on what a dbWhere object is, how to create one, or how to pass that dbWhere object into your dbWheres list. My question is, does anyone know how to use this new “dbWhere” syntax in a LookupRowFieldValue function, or know how to do something similar with a different function? Just looking for some sample code I can leverage. Thanks,3.7KViews1like4CommentsIssue With Referencing Global Variables in Connector Business Rules
Hi all, I am facing an issue regarding my ability to reference global objects between two different business rules, one of which is a finance business rule and the other of which is a connector business rule. To be more specific, the flow goes like this: First, I execute the finance business rule function that generates my global object, which is a DataTable, from a connector business rule: BRApi.Finance.Calculate.ExecuteCustomCalculateBusinessRule(si, "Utilities", "GetDataTable", povInfo, CustomCalculateTimeType.MemberFilter) Then, in the GetDataTable function of the Utilities finance business rule, I create a DataTable and save it as a global object: Dim dtCEDR_Integ As New DataTable("CEDR") 'add data to data table globals.SetObject("dtCEDR_Integ", dtCEDR_Integ) Then, back in the connector business rule, I try to get that global DataTable object. Dim dtCEDR_Integ As DataTable = globals.GetObject("dtCEDR_Integ") However, when I attempt to import the data via the data source that is attached to the connector business rule, I get this error: "Unable to execute Business Rule 'BudFm_BudEx_Connector'. Object reference not set to an instance of an object." Interestingly enough, the error doesn't happen when I get the global object (i.e. step #3 above) - it happens when I try to reference properties of the datatable, ex. dtCEDR_Integ.Rows.Count.ToString This error confuses me greatly because I can do the exact same thing, except instead of using a connector business rule, I use an extender business rule, and everything works just fine. Is there something special about connector business rules that doesn't allow them to look at global variables the same way as other business rule types? Or am I just doing something wrong? One additional piece of information that may be helpful to know is that the datatable that I am trying to generate does pull data from a cube that is separate from the cube that I'm importing into as specified in the data source. I don't think this would be causing issues but I want to add that in case that would in fact be an issue. Thanks in advance and I am looking forward to learning more about this confusing scenario.Solved3.5KViews0likes10Comments[howto] Use "Insert Code" when posting on Forum boards
Hey guys! Just a reminder: if you're going to post code in this forum, please make it easier to read by using the "Insert/Edit Code Sample" button on the expanded formatting toolbar. Here's a short video showing how it works. If you need to edit code after you created the block, just double-click on it. Ideally you'd also indent it first, either in an editor or with something like DotNetFiddle. Remember: the easier it is for others to read your code, the more likely that they'll be able to solve your problem! Cheers! Your friendly neighborhood Spider-Mod3KViews4likes6Comments