Moving document to a folder depending todays date

Certified Senior Developer

Hi all,

how can input the documents destination in the move document smart service process node without hard cording the folder name, depending on todays date the document will be sent to a specfic folder. for examle I have a parent folder called Documents. inside I will 4 subfolders, Period 1, Period 2 , Period 3, Period 4. but these will be created throughout, so for now I only have Period 1.  If today is a date is january 2 t will go to period 1. but when we reach the date of march 1 it will create the second folder period 2, and then any documents after this date I want them to go to period 2 folder and so on. 

What is the best way to approach this?

thanks in advance

  Discussion posts and replies are publicly visible

Parents
    1. Create your folder structure in advance. It sounds like every year will have 4 periods - 1,2,3 and 4. Each covers 3 months (from what can be assumed given the info you've provided). There's no reason to wait to create the subfolders. You could create folders for the next 100 years and be pretty sure that'll cover the life of your system. You could write a one-off utility process model to do this.
    2. You can then set up a Decision Rule to return the appropriate folder for the Year/Month combination. You can ease the burden a bit and only have 4 rows per year by a) using the "First - This decision returns outputs for the first match" option, b) matching exactly on the input year, and  < 4, < 7, <10, <13 in that order, like this:

    It'd be slow to set up all of the rows you need but once done it's done.

    3. The you simply derive the Year and Month from now() and use those values to return the relevant folder as input to your smart service

  • 0
    Certified Senior Developer
    in reply to Stewart Burchell

    thanks for responding! Can you explain how could I do the  one-off utility process model for the subfolders?

  • 0
    Appian Employee
    in reply to Maria

    Create a nested loop. In the outer loop seed your Start Year  (e.g. 2023) and have it loop through until your End Year. For example you may start in 2023 and end in 2123 (100 years!). 

    Within each iteration of the Year you'd:

    1. create the Year folder
    2. create a loop to create Period 1,2,3 and 4 Folders, all within the current Year folder

    So your outer loop may look like this:

    and your inner loop (contained in the sub-process) like this:

    This would run sequentially, and there are other ways to achieve the same outcome faster (you could spawn all 4 Create Period processes concurrently but probably not worth the effort)

Reply
  • 0
    Appian Employee
    in reply to Maria

    Create a nested loop. In the outer loop seed your Start Year  (e.g. 2023) and have it loop through until your End Year. For example you may start in 2023 and end in 2123 (100 years!). 

    Within each iteration of the Year you'd:

    1. create the Year folder
    2. create a loop to create Period 1,2,3 and 4 Folders, all within the current Year folder

    So your outer loop may look like this:

    and your inner loop (contained in the sub-process) like this:

    This would run sequentially, and there are other ways to achieve the same outcome faster (you could spawn all 4 Create Period processes concurrently but probably not worth the effort)

Children
No Data