Forum Discussion

franciscoamores's avatar
franciscoamores
Contributor II
2 years ago
Solved

Loading Amount and Annotations together

Hi,

not sure if anyone came across with this one but thought it was interesting to share

If you have a file which has in the same line amount and annotation you can set View to YTD (or periodic), then in the text value complex expression use this api prop:

api.Parser.TextValueRowViewMember = "Annotation"

That will make the parser to automatically generate the line(s) with the annotation if text value have a value.

HTH

  • Thank you Francisco.  I was able to use this on a customer this morning to load annotation via import on a matrix load to only M12 and this worked like a charm!

4 Replies

  • T_Kress's avatar
    T_Kress
    Icon for OneStream Employee rankOneStream Employee

    Thank you Francisco.  I was able to use this on a customer this morning to load annotation via import on a matrix load to only M12 and this worked like a charm!

    • StephD's avatar
      StephD
      New Contributor III

      Can you provide detail how you limited it to just M12 on the Matrix Load?  

      • T_Kress's avatar
        T_Kress
        Icon for OneStream Employee rankOneStream Employee

        I had to dig up some old notes but here is the general gist of what I had to do to make this work:

        • In addition to our 12 matrix time columns that come in as normal YYYYM1 – 12 we added a 13th matrix time column
        • In this 13th column we had it come in as YYYYANNOTATION and then I made YYYYANNOTATION to YYYYM12 in mapping rules
        • Then we had to add 2 parser business rules
          1. One we attached to the Amount matrix column in data source
          2. One we attached to the TextValue matrix annotation member column in data source
        Namespace OneStream.BusinessRule.Parser.BR_MatrixAmount
        	Public Class MainClass
        		Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As ParserDimension, ByVal args As ParserArgs) As Object
        			Try
        				
        				If API.DimensionDelimitedPosition = 27 Then 		'look at 13th column which is year total column
        					globals.SetBoolValue("IncludeComment",True) 	'set annotation global to true for only this column
        					api.ValueIsZeroSuppressed = False				'do not bypass zeros only on this 13th column
        					Return 0.00										'set amount in 13th column to 0.00
        				Else
        					globals.SetBoolValue("IncludeComment",False)	'set annotation global to false for all other columns so we only bring in comment to M12
        					Return args.Value								'leave all other amounts as-was
        				End If	
        				
        				Return Nothing
        			Catch ex As Exception
        				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
        			End Try
        		End Function
        	End Class
        End Namespace
        Namespace OneStream.BusinessRule.Parser.BR_MatrixComment
        	Public Class MainClass
        		Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As ParserDimension, ByVal args As ParserArgs) As Object
        			Try
        				
        				api.Parser.TextValueRowViewMember = "Annotation"		'pulls in textvalue column as annotation view member
        				
        				If globals.GetBoolValue("IncludeComment",True) Then		'if comment column is true which is only true for 13th column
        					Return args.Value									' allow comment to pass through
        				Else
        					Return String.Empty									'otherwise if not 13th column then do not bring in comment annotation member
        				End If	
        
        				Return Nothing
        			Catch ex As Exception
        				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
        			End Try
        		End Function
        	End Class
        End Namespace

         

        Basically the end result is that we were able to manipulate the 13th column which I associated with only YYYYM12 to bring in a 0.00 amount only for columns in which the customer enters an annotation member.  The combination of allowing a 0.00 to come in is what ultimately allows the comment to come in to T#YYYYM12:V#Annotation and without having to mock up a penny or something.

        I will say that if I recall, this still brought in the commentary to all 12 months, but our issue was that it was not bringing in commentary to the 12th month if that month did not have an amount.  So what we solved for was ultimately ensuring that all commentary was brought into M12 (even though it was also brought in for M1 - 11 which we did not need but lived with).  I think.  But it may also be that we got this to only bring in commentary to M12.  I cannot recall 100% but the above is how we achieved this.