Skip to main content
April 4, 2023
Solved

matrix parser rule to change date to long

  • April 4, 2023
  • 1 reply
  • 0 views

Hi, I have a matrix data source matrixed on Account.  Sample below.  One of the Account fields is a Date that I need to convert to a Long to store.  I can do the conversion but not sure how to target the value to convert when in a matrixed data source.

If it were a delimited data source I would use: Dim sDateField As String = api.Parser.DelimitedParsedValues(6).  Is there a way to identify the value in a matrixed data source?

thanks

Greg

Code1 Entity Account1 Account2 Account3
Test1 Entity1 1/1/24 0.025 0.5
Test2 Entity2 5/1/24 0.025 0.5
Test3 Entity3 3/1/25 0.025 0.5
Best answer by GregHertling

In your source filehow many Account columns? Did you create the same amount of Dim in your DataSource? Did you set up the Matrix Header Values Line#  to 1 for each dimension/headers?Then did you do your transformation for all the account Headers?

NicolasArgente_0-1680876940461.png

Can you send us a picture of the right side of the Data Source? And an Account Dim print screen as an example?




Hi, we actually have over 300 Account columns in the source file with various data types.  I was finally able to get this to work.  First I had to ignore any columns with no data.  Then before the return statement I had to add: api.ValueIsnumeric = True.  thanks for all of the help.

1 reply

April 5, 2023

You should be able to get your source value with args.Value, or the whole line with args.Line, or try to get the line in a dictionary with api.Parser.GetFieldValuesForSourceDataRow(si, api.RowGUID).

April 5, 2023

hi Jack thanks for the reply.  I had tried args.value and args.line but those only return the header row (Args.Value=Account1; Args.Line=Code1, Entity, Account1, Account2, Account3)  I'm not quite sure how to use GetFieldValuesForSourceDataRow but I can't return anything meaningful with it so far.

April 5, 2023

Sorry, just to clarify, is this DS a Fixed, Delimited, or Connector? I'm just trying to understand where you're running code.