Getting data from Stage in Finance Business Rule

osdevadmin
New Contributor III

Hi there,

thankful for immense contribution from community that has made life easier as a system admin. Currently working on a requirement to query stage data for specific Entity, Account, Scenario, UD1 through UD5 and reseed it back to a intersection that got changed by user input to allow admin to revert any changes done by users. I tried using the below:

 

Dim criteria As New Text.StringBuilder
criteria.Append("U1T = '" & ud1_seeded & "' ")
criteria.Append("And U2T = '" & ud2_seeded & "' ")
criteria.Append("And U3T = '" & ud3_seeded & "' ")
criteria.Append("And U4T = '" & ud4_seeded & "' ")
criteria.Append("And U5T = '" & ud5_seeded & "' ")

Dim dValue As Decimal = api.Functions.GetStageBlendNumber("TestCube", "TestEntity", _
    "TestScenario", "2024M1", "TestAccount", BlendCacheLevelTypes.Custom, "Test",  _
    "TestWorkflowProfileName", "U1T,U2T,U3T,U4T,U5T", criteria.ToString, "Amount", _
    BlendNumericOperationTypes.FirstValue)

 

doesn't throw a error, but its not getting the amount seeded for TestAccount for the above mentioned workflow profile name. I checked the onestream function documentation, it says the following function documentation:

Dim dValue As Decimal = api.Functions.GetStageBlendNumber(cubeName, entityName, scenarioName, timeName, accountName, cacheLevel, cacheName, wfProfileName, fieldList, criteria, fieldToReturn, mathOperation)

Are my cacheLevel and cacheName correct i set cacheName as "Test" and cacheLevel as BlendCacheLevelTypes.Custom? any other inputs are appreciated

7 REPLIES 7

Adam_Bridges
New Contributor

I'm trying to understand the use case here.. Is the process or issue more complex than removing amounts in O#Forms to restore what was originally loaded?    Are user changes being captured outside of the cube initially?

osdevadmin
New Contributor III

@Adam_Bridges thank you for looking in to this! there is some amount that gets seeded initially in  TestAccount for O#Import, based on user input in Form in O#Forms, there is business rule that is run that modifies amount for TestAccount for O#Import, but we want to give admins a feature that would restore the original seeded amount for A#TestAccount for O#Import before user made the changes. Currently this process is manual where we have to manually go into stage note down the original amounts and run a dm job, we want to do auto lookup of the amount based on POV that a user would enter in an admin form

JackLacava
Community Manager
Community Manager

The caching parameters for GetStageBlend* apis are in the Finance Rules and Calculation Handbook on page 119, but in your case I don't think they're a problem - that cache is created by your call whichever way you want, worst that can happen is that you create an inefficient one, but numbers should still come through. (This said, I'd stick to one of the predefined shapes rather than going for Custom...)

I think the problem for you is more likely to be the Workflow Profile Name, which has to be complete - e.g. "SomeProfile.Import".

osdevadmin
New Contributor III

Thank you @JackLacava i corrected the Workflow Profile Name and used  BlendCacheLevelTypes.WfProfileScenarioTimeEntityAccount no error, calc took little more time but still getting 0 As result instead of the Amount in the stage.

🤷‍ Try using GetStageBlendDataTable instead, which requires fewer parameters, and check what it contains in terms of fields and records.

osdevadmin
New Contributor III

Thank you @JackLacava , will do and report back 👍

This doesn't work as well, I looked at the book as well, and it uses a UD8 member to define the above, haven't tried it yet. But even if does work, unsure if it would work i.e  calling UD8 member in finance business rule, as we would be asking finance business rule to execute a dynamic calc, unsure if it would work