Created
April 12, 2020 15:41
Star
You must be signed in to star a gist
Azure Logic App - Inline Code - Multi Part Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var titles = workflowContext.actions.Filter_array_on_year.outputs.body; | |
var newTitles = []; | |
const regex = /(.*)(2019|2020|2021).*/i; // Regex for year filtering | |
titles.forEach(function(item) { | |
// Additional filter for titles containing 1080p only | |
if (item.title.indexOf('1080p') > -1) { | |
// Extract the title and year only | |
var titleMatch = regex.exec(item.title); | |
if (titleMatch!=null && titleMatch.length>0) { | |
var tidyTitle = titleMatch[1]+titleMatch[2]; | |
var pubDay = item.pubdate.substr(5, 2); // Get the day number | |
tidyTitle = pubDay + " - " + tidyTitle; | |
// Simple dedupe | |
if (!newTitles.includes(tidyTitle)) newTitles.push(tidyTitle); | |
} else { | |
newTitles.push(item.title); | |
} | |
} | |
}); | |
return newTitles; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment