Exporting Project Files Based On Date
  • 30 Aug 2021
  • 2 Minutes to read
  • Dark
    Light

Exporting Project Files Based On Date

  • Dark
    Light

Article summary

Example Lab Article
While Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released.

Overview

Example Lab Details

Version7.6.0
Root FolderExample Lab - Exporting Project Items Based On Date
Modules None
DependenciesNone

This Example Lab demonstrates how to selectively export files in a Decisions project .zip folder based on their modified dates.


Explanation

Open the "getFilesbyDate" Flow available in the project download .zip file at the bottom of this article. This Flow prompts two inputs by the end user: the .zip file of the project to be sorted and the desired sort date: "getFilesAfterDate". This project's .zip file may be used as sample data as well as any other Example Lab's .zip file if needed. 

The Unzip Files step unzips the uploaded project .zip folder and then the ForEach step checks each item within the .zip for their last modified date. To achieve this, the Get String From Byte step grabs the byte contents of each item and converts them into a string data type. This string output is used in the next step; Extract Text from Text, as the source text to search for the item's modified on date. The configuration of this step is shown in the screenshot below. The end text and start text includes special characters since the string was originally a byte file type. Afterwards the Greater Than (Date) rule checks if the item occurs after the desired sort date. This rule's inputs maps the End Date to the "getFilesAfterDate" date and while the First Date's utilizes the Run Converter input mapping. Selecting Edit Converter opens a Flow containing the Parse Date from Input String step which takes string and converts it to the date data type. For the String to Convert input under the Edit Converter Button, the output of the Extract Text from Text step is selected. If the item does not occur after the date, the false path occurs thus restarting the loop if applicable. Otherwise, the item is sent to the Split String step to grab the item's name based off it's file name. The "/" is used as a separator, again, due to the contents originally belonging to the byte data type. Finally, the item is then added to a list of fileData by mapping each new item's contents to Item.Contents and it's file name to the output of the Split String step. The original list and output are named "New ZipFile" so each iteration of the loop adds to the list. The loop then restarts if applicable.

After the loop is complete, the Object is Null rule checks if any of the items' modified dates occurred after the desired date. If not, then nothing is exported ending the Flow. Otherwise, the Zip Files step zips the "New ZipFile" list of fileData into a new .zip file. The Form at the end then prompts the end user to download the new .zip file now containing only the files after the desired date. 

Reference Articles


Project Download

The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 7.6.0 or later using our Importing/Exporting article.





Was this article helpful?