Forum Discussion

jzachar's avatar
jzachar
New Contributor
6 months ago

Bypass import records based off date in records (Time Dim)

How would I bypass import records where the time is not equal to the WF Time POV?

  • You can bypass records at the Data Source level.  You would need to add a complex expression to the Time dimension of the data source.  It could look something like this:

    Dim WFTimeStr As String = api.CurrentDataClusterKey.TimeName
    Dim FileTime As String = args.Value
    
    If FileTime.XFEqualsIgnoreCase(WFTimeStr) = True Then
    	Return args.Value
    Else 
    	globals.Bypass = True
    End If
    

    Test and see if you can get that to work.

     

     

     

     

  • You could use this to get the month:

    Dim thisMon As String = WFTimePOV.Split("M")(1)

     

  • T_Kress's avatar
    T_Kress
    Contributor III

    You can bypass records at the Data Source level.  You would need to add a complex expression to the Time dimension of the data source.  It could look something like this:

    Dim WFTimeStr As String = api.CurrentDataClusterKey.TimeName
    Dim FileTime As String = args.Value
    
    If FileTime.XFEqualsIgnoreCase(WFTimeStr) = True Then
    	Return args.Value
    Else 
    	globals.Bypass = True
    End If
    

    Test and see if you can get that to work.

     

     

     

     

    • jzachar's avatar
      jzachar
      New Contributor

      you are correct that the code pulls in the WF time POV.  Unfortunately, the time in the file is year and month.  I could simply check month, but I get errors trying to substring the month out of the WF Time POV (2024M1, etc).  Instead of TimeName is there a way to simply pull the Month (I haven't had any luck finding it)?

      • MarcusH's avatar
        MarcusH
        Contributor III

        You could use this to get the month:

        Dim thisMon As String = WFTimePOV.Split("M")(1)

         

  • MarcusH's avatar
    MarcusH
    Contributor III

    As T_Kress says you can stop the records being imported through the Data Source. As this is the Time dimension it's not an audit problem; if it were another dimension I would not recommend this. An alternative is to bring in all the records and then Bypass them using Transformation Rules. The problem though is that the Time dimension only has OneToOne maps and you do not want to play around with the maps period by period. If you import the Time member into another dimension as well as the Time dimension itself you can then use a Mask rule with a Business Rule attached. The BR then gets the current POV and sets the result to Bypass if it's not the correct period. This other dimension that you use will not normally be used in the application eg UD7 always defaults to None. If you don't have an unused dimension, you can use a TransformationEventHandler to update the maps where the Time period is incorrect. Transformation Rules method is the better option.