Forum Discussion

DEReam23's avatar
DEReam23
New Contributor
3 days ago

Matrix data load with entities in columns

Is there a way to set up a single matrix data source for a file with accounts in rows and entities in columns where the entities could change, as well as the number of entities?  Can you set up matrix for max number of entities and read entity from specific row?

1 Reply

  • MarcusH's avatar
    MarcusH
    Valued Contributor

    The matrix Data Source will need to have the maximum possible number of Entity columns. You would then need to have a Transformation Rule to handle empty Entities so that they are set to Bypass (eg set the Leading Fill Value to # and then map # to Bypass). You can read the Entity from a specific row. Golfstream app has an example. You have a Parser script to save the Entity value to a variable in Globals and another Parser script to retrieve the variable value. The first script in Golfstream is called XFR_Delimited_Get_Amount. This saves the Entity to the variable 'Entity' (line 12):

    Dim strLine as String = args.Line
    Dim sections as List(Of String) = Stringhelper.SplitString(strline, ",", vbNullString)
    Dim Entity as string = sections(0)
    
    'Check first Char of line.  Header lines start with !
    If strline = "2012 Proforma Information,,,,,,,,,,,,,,,,,,,,,,,,," Then
    		'Globals.SetStringValue("Entity","")
    		Globals.SetStringValue("strflag","True")
    Else 		
    	
    	If Globals.GetStringValue("strflag") = "True"
    		Globals.SetStringValue("Entity",Entity)
    		Globals.SetStringValue("strflag","False")
    	End if
    	
    End if
    
    Return args.Value				

    And the second script is XFR_Delimited_Get_Entity which simply gets the value from the Globals object:

    Return globals.GetStringValue("Entity")