Date time tadk

In that file there is output file also given we have to find employee name date start time and time
And name is in capital firstname and surname
In every file we have to only take text file and date is given in folder name and start and end time we have tAke from txt file first and last txt file time

Example. In the first folder Ajay we have 4 txt file than we have to take starttine is 9_35_14
And last 10_32_15

Please guys please help me it’s urgent
11.zip (980.4 KB)

Send the workflow if it is done xmal file

Please help me @MdFuadHasan
@Gokul001

Hello @purnima_mandan

Here of reach candidate there are multiple folders inside the parent folder. Which folder and files need to consider?

Just consider “Lalit.pawar” and share the screenshot of the folder and file need to use.
Thanks

We have considered all the folder
First it will take lalit pawar
In that it take first folder in that there it will take only txt file
And in that txt file it will take start time and and time it given in the txt file name title like 9_35_14
And end time is 10_32_15

After it will go back and take next date folder name

So all file take of lalit
After it going to Rekha
And same Samir

Please help me it’s urgent @Rahul_Unnikrishnan

@purnima_mandan

You can try as below. Hope it should work in your case.

image

image

Expression to get last file : Directory.GetFiles(yourfolder_path,“*.txt”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)

Expression to get first file:

Directory.GetFiles(yourfolder_path,“*.txt”).OrderByAscending(Function(d) New FileInfo(d).CreationTime).Tolist(0)

Then using this files names you get the time using string manipulation (substring ,split or regex methods)

Thanks

can you share xmal file

Try to create as I mentioned in the screenshot. If you get stuck somewhere i can help.

Thanks

Firstfile and last file variable?
And what path I give to both for each

You can remove for each file in folder activity.

Firstfile and lastfile is a string variable.

yourfolder_path need to be replaced with CurentFolder.

image

Thanks

It will give error in fileinfo in first assign
And in for each path which I give

Hi @purnima_mandan

Try this

DateTimeTADK.xaml (13.4 KB)

Please can you show me another method also because I have to show 2 method @kumar.varun2

Hi @purnima_mandan

Second method - using the group by approach (nested looping is not required)

(
	From arr In Directory.GetFiles(RootFolderPath, "*.txt", SearchOption.AllDirectories).Select(Function(fp) fp.Split("\"c).Reverse.Take(3))
	Group arr By
	k1 = arr(2),
	k2 = arr(1)
	Into grp =  Group
	Let TArr = grp.Select(Function(gp) gp(0).Split("T"c).Last.Substring(0,8)).OrderBy(Function(g) CInt(g.Replace("_","")))
	Select dt_Out.Rows.Add(New Object() {k1.Split("@"c).First.ToUpper.Replace(".", " "), k2.Replace("_", "-"),  TArr.First.Replace("_", ":"), TArr.Last.Replace("_", ":")})
).CopyToDataTable

xaml

DateTimeTADK_v2.xaml (8.6 KB)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.