Hi Jack,
Back here again as the solution that did work is working but not direct from CubeView designer, it only works when activated as a form from a template. We have recently upgraded to ver 7.4.4 from 7.3.1. being the only difference. Because it did end up working on the earlier suggestion of using .Text2 as apposed to the .20000 value, then I did not return and reply to you.
However, now I am wondering if your point is more relevant. At the moment the Business Rule is being called with this syntax BRString(BMK_MH_Helper,GetColFormula) as a UD4 field. The rule is sat in the Dashboard XFBR String sub-folder of Business Rules. So is it in the wrong place and if so where is best ? Does this impact the cause of the error when running from CubeView designer rather than from a Form template ?
I have included the full script below. What it is aiming to do ( and was working back in June ) is create a dynamic formula based on the currency value held in the Text2 property and then create a col1+col2+col3 etc formulae but exclude the column relating to the value found in the Text2.
Namespace OneStream.BusinessRule.DashboardStringFunction.BMK_MH_Helper
Public Class MainClass
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As Object
Try
If (args.FunctionName.Equals("GetColFormula", StringComparison.InvariantCultureIgnoreCase)) Then
Dim MHClusterPK As WorkflowUnitClusterPk = si.WorkflowClusterPk
Dim MHScenarioTypeID As Integer = BRApi.Workflow.General.GetScenarioTypeId(si, MHClusterPK)
Dim myCurName As String =BRApi.Workflow.Metadata.GetParent(si,args.SubstVarSourceInfo.WorkflowUnitInfo.ProfileName).GetAttributeValue(MHScenarioTypeID, SharedConstants.WorkflowProfileAttributeIndexes.Text2)
'BRApi.ErrorLog.LogMessage(si, "ScenTypeID = " & MHScenarioTypeID)
'BRApi.ErrorLog.LogMessage(si, "CurrVal Here 123= " & myCurName)
Dim myColNum As Integer
Select Case myCurName
Case = "GBP"
myColNum=1
Case = "USD"
myColNum=2
Case = "EUR"
myColNum=3
Case = "NOK"
myColNum=4
Case = "CHF"
myColNum=5
Case = "ISK"
myColNum=6
Case = "VND"
myColNum=7
Case = "HKD"
myColNum=8
Case = "DKK"
myColNum=9
Case = "COP"
myColNum=10
Case = "MXN"
myColNum=11
Case = "BRL"
myColNum=12
Case = "IDR"
myColNum=13
Case = "THB"
myColNum=14
Case = "CNY"
myColNum=15
Case = "TRL"
myColNum=16
Case = "INR"
myColNum=17
End Select
Dim myres As String
myres = "C#Local:U4#None:Name(Check Total):GetDataCell(CVC(Total)-CVC(Col0)"
For a = 1 To 17
If a <> myColNum Then myres = myres + "-CVC(Col" & a & ")"
Next a
Return myres & ")"