Quick "Remove" Array Question

Options

Hi guys - Seems elementary for me but there is something wrong in my "remove" from array setup I have here. I simply want to remove items from the results array in which the 'created_at" (as a timestamp), is before or less than the most recent log timestamp (Above). It seems to be not working (not finding any true statements as is)… I know im close lol but what do i have wrong?

Comments

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options

    Hi, @JonnyNeal! It looks like this might be because the returned timestamps are in different formats. log_timestamp is in milliseconds, and the values in your array are human readable.

    If you're transforming these timestamps before the remove function, it seems like the easy solution would be to just move this step before the transformation occurs.

    If these values are not being transformed in your function stack (for example, if this is how the data is returned from the external API), you would want to apply a parse_timestamp filter before your less_than filter to turn it into the same format that you're trying to compare to.

  • JonnyNeal
    JonnyNeal Member
    Options

    Hey Chris! Thanks for this response! Was a bit hard for me to understand where to put what without a visual so I did what I know and created a loop with the log timestamp < each objects created at. I "wanted" to try and learn more about some of the advanced parts of filtering like this as I knew I could loop through and that is just the way that I know, but I wanted to figure out this method that removes from the array in that one little bit.

    Mind posting a quick screenshot of where you would convert my created at item to timestamp? Thanks! Jon