Forum Discussion

GregHertling's avatar
GregHertling
New Contributor III
2 years ago

matrix parser rule to change date to long

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
  • GregHertling's avatar
    GregHertling
    2 years ago

    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.

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    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).

    • GregHertling's avatar
      GregHertling
      New Contributor III

      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.

      • JackLacava's avatar
        JackLacava
        Honored Contributor

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