LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Removing columns with dates in the header based on a date range

    Employee
    Posted 02-05-2015 19:56

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    Hi everyone, I'm looking for a way to create an 8 week rolling dataset. Every week I import existing data then add new data to the left fields. All columns have the week ending Friday date added as a field prefix with that week's date so it looks like below/attached picture.

    What I'm looking for is to remove all columns that are more than 8 weeks old based on this prefix. All dates are W/E Friday so always 7 days apart.

    LS EX.jpg

    Cheers,

    DaveLS EXAMPLE.zip


  • 2.  RE: Removing columns with dates in the header based on a date range

    Employee
    Posted 02-07-2015 15:34

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ryeh

    See attached graph. We use the Metadata node to first get the column names. A filter node is used to check to see if the field names contain a date. If so, a calculation is done to get the difference between today (system date) and the date in the field name. The split node gets only the fields within a certain range. In this case, I chose 4 weeks, as the dates in the field name span 8 weeks. The last step is to use the Change Metadata node.
    Attachments:
    wthin_n_ weeks.brg


  • 3.  RE: Removing columns with dates in the header based on a date range

    Employee
    Posted 02-08-2015 19:38

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    Thanks Ryeh, will check this out.
    What does the "out = TRUE" line do ?

    eg.
    if FieldName.isDate("CCYY-M-D")
    then {
    out = TRUE


  • 4.  RE: Removing columns with dates in the header based on a date range

    Employee
    Posted 02-08-2015 20:37

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ryeh

    Ah, good catch. That was actually leftover logic that can be removed. I originally used it to keep track of which fields to emit. So even if a field did not contain a date in the name, I still want to emit it. But I took on a different approach and just used dateDiff as a check. So if a field did not contain a date in the name, I set the dateDiff to 0. That way, it always gets included in the following split node. I've attached an updated graph with the cleaned up logic.
    Attachments:
    wthin_n_ weeks_1.brg


  • 5.  RE: Removing columns with dates in the header based on a date range

    Employee
    Posted 02-22-2015 16:25

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    Worked perfectly as always, thanks again.