There are cases when I want to look up data from an application database and return it to a business rule for further use. I may want to look up a single field value, I may want to return multiple rows or fields or I might want to do manipulation of the data through SQL code. In this case, especially if I want to do any sort of transformation of the data using SQL, I use the BRApi.Database.ExecuteSqlUsingReader API function.
This function allows me to pass in a SQL Query. If you can pass in a SQL Query then the sky is the limit as to the transformations you can do. Want to link multiple tables? Do Unions? Recursive Joins? You name it, you can do it here. I have even joined application database tables with other custom databases within OneStream and returned those results.
For explanation purposes I have kept the sql in this example to a single line of code that returns a single result. However, you can place any sql you want into the section where you define your sql statement to be passed. I have found no limitations to what I can place in this section.
For example purposes I have a table within the application database called XFC_Member_Rename which contains 3 fields, I am going to pass it a value in the OldMemberName field and return a Value from the NewMemberName field.
In the next steps I have created this code in an Extensibility rule and I call that with a Data Management Step, for demonstration purposes.
Note that you can connect to more than the Application Database.
Here is the function in its entirety
I have found the BRapi.Database.ExecuteSqlUsingReader function to be a very powerful function and have used it extensively to query Application Tables (and others) using the SQL Query to do extensive transformations of the data.
To learn more about OneStream and how MindStream Analytics can help you improve your planning, reporting, and analytics, please fill out the form below.
Join us for a compelling webinar as we delve into the revolutionary capabilities of OneStream Software for corporate performance management (CPM).
OneStream: The Power of One Platform for Intelligence Finance
OneStream CPM
OneStream aligns to your business needs and changes more quickly and easily than any other product by offering one platform and one model for all financial CPM solutions. OneStream employs Guided Workflows, validations and flexible mapping to deliver data quality confidence for all collections and analysis while reducing risk throughout the entire auditable financial process.