# How Can I Assign Specific Quarters using Variables?

Hello everyone,

I would like to find a file with name of the expression that I will be describing below in detail.

I have 4 quarters such as :
Q definitions:
Q1: Documents expected to be uploaded from March 15 to April 15.
Q2: Documents expected to be uploaded from June 15 to July 15.
Q3: Documents expected to be uploaded from September 15 to October 15.
Q4: Documents expected to be uploaded from December 15 to January 15.

whenever we are in that year, the expression will change. For example, if we are on January 5th in 2022, then our expression will be Q4 2022.
I am confused how to deal with it.

Hi,

To identify that file you can use below statement.

Directory.GetFiles(folderPath+“Q”+CInt(Math.Ceiling(Now.Month/3))+System.DateTime.Now().Year.ToString+“.*”)

Hope this helps.

Regards,
Sruthi YNM

lets assume a date like 2nd February 2022. How to handle this, what are the requirements more in detail?

Thank you @ynm_Sruthi but I do not have file path since I am working on a website. And if i click on names of files, i can download them. And by the way, how can i handle it if we are in months lets say May? That is why your expression will not be working well. Thank you anyway.

If the date is like 2nd February, then the robot does not need to work since there is no file related to the other dates. The files are uploaded according to the quarters. That is why I need to download the files whenever we are exactly in that date. To be more specific, the name of files is like " jfgdsfg Q1 2021 JKSGFKS", " 123FHJFG Q4 2022 TYOIREY78" and so on.

Variables:

Flow:

LINQ:

``````(From x In arrQDef
Let y = chkDate.Year - Convert.ToInt32(chkDate.Month = 1)
Let sdt = CDate(x & y).Date
Where chkDate.Date >= sdt And chkDate.Date <= edt
Let q = Array.IndexOf(arrQDef , x) + 1
Select s = String.Format("Q{0} {1}", q, y)).FirstOrDefault()
``````

chkDate is the Date you want to check e.g. now or any other DateTime Variable

TestSerie:

Kindly note: You also can decompose afterwards the prototype LINQ statement to essential activities

Find starter help here:
MapDateRange_ToCustomQuarterDef.xaml (8.3 KB)

Thanks a kot @ppr for your helps. I’ll examine in detail but this solution looks great and hope to work well. Thank you again.