Advent Challenge #5

Advent Challenge #5 | Advanced | C#

Santa is annoyed at Jingle Bell, but he is a Maradona fan. To honor the Football Great and get hi attention, Santa invokes the ‘divine free-kick’ of NAPOLI vs Juventus 1985 and kicks the Wishes.zip file into the \incoming folder of Santa_Stream

The Football great maneuvers the files and unzips them into the \Wish folder. The idea here is to untangle the files to clear up Jingle Bells mess . Diego needs all the expertise he put in at NAPOLI vs Lazio in 85.

And as unique as Maradona’s magic is, each unzipped folder gets a unique ID

The football great navigates through the mess in the files and dedupes them - 2 files are not a problem because he beat 4 Belgians to score an awesome goal for his team during ARGENTINA vs Belgium 1986 World Cup

As the final act, the Great Master scores the ‘Goal of the Century’ of ARGENTINA vs England 1986 World Cup to kick the Deduped File into the \outgoing Santa_Stream folder !!!

Santa got his wish of getting all of the Wishes deduped! :smiley:

image

With this code, hopefully Santa can do it himself the next time.

Cheers!
UiPath_Advent2020_Advanced5_CSharp_rpavanguard_Maradona_Style.xaml (20.2 KB)

5 Likes

:snowflake: Beginner:

Santa booked his ticket for the cricket :cricket_bat_and_ball: :cricket_bat_and_ball:match and very eager to see watch the “Boxing Day” test match between India :india: Vs Australia :australia: on 26th…When he opened the ticket zip he got two tickets so he has to delete the recently booked ticket.

image

Let’s use dictionary to solve this problem… :wink: :rofl: :sunglasses:

Here you go Santa, Duplicate ticket has been deleted…

Santa is dreaming about watching the match

XAML: Advent_Challenge5_Beginner.zip (63.0 KB)

4 Likes

Advanced Challenge 5

Santa! We heard you have some problem so we came here to help you, even if it’s winter!

Ok… we are a little scared by the temperature, but we’ll get into work right now!

The first step is to unzip the file and extract the data from the Excel…done!
image

So, now the hard part…we have to merge all this data and check the rows one by one? You’re kidding, it will take a lot of time, and we like to go fast!
image

With the help of UiPath activities we are able to merge all the informations in just one file
image

Lastly, we have to create a new Excel and write the Data, but with a little bit of Jamaica inside!

image

So we did it!
image

See you later Santa, and don’t forget to come to Jamaica, even if it’s not your ideal climate!

image

AdvChallenge5.xaml (9.7 KB)

6 Likes

Beginner
Hello Santa it would help you to delete the latest created file begineer5
Advance
this flow help you to delete the duplicates in two files and give the resultAdvance5
begineerAdvent5.xaml (12.0 KB) excel.xaml (6.0 KB)

4 Likes

Beginner
Santa is all excited to deliver kids gift and he just realized the mess and need help in choosing the right file from below
image

Santa need not worry, UiPath can find an easy solution.
Approach used: Iterate through the folder, compare FileCreatedDateTime and store the file to be deleted.On loop exit delete the file.
Here is the execution result
image
Santa is very happy and have now time to go for a match
image
Below is the code
Challenge5.xaml (8.7 KB)

4 Likes

Panic in Santa Inc. :scream: :scream: :scream:

image

Hey Jingle-Bell,

I will help you on the versioning before Santa heard. We’ll got it :wink: :wink: :wink:

Beginner:

First let’s take a look at out files and the creation times.
image

After that with a magical LINQ, we get the latest created file
image

image

And destroy it
image

The full workflow with the output:

image

AdventChallenge_5_Beginner.zip (57.0 KB)

Advanced

Read all the files in the input folder and merge them all!


image

Removing the duplicate rows


image

:tada: :tada: :tada: And here is your final wish list! :tada: :tada: :tada:

image
image

AdventChallenge_5_Advanced.zip (70.3 KB)

Cheers!
image

3 Likes

As the year draws to an end, Santa’s football team, “The Eleven Elves”, faces off against Easter Bunny’s team, Bucktooth FC.

However, things don’t look very good. It is minute 89’ and Santa’s team is 1-0 down, thanks to an own goal by his defender, Jingle Bell.

image

Beginner challenge

However, Santa’s team wins a free-kick on the edge of the box. Santa brings in his power substitute Ronaldinho.

As the coach, Santa explains to him that a weakness needs to be found in the bunnies defense. One among the two of the Bucktooth central defenders is older, and Ronaldinho needs to float the freekick next to him so that one of Santa’s elves can head the ball in.

Ronaldinho racks his brain and recognizes that to find the older defender, he need to invoke a .NET query:
image

With utmost focus, Ronaldinho takes the free-kick:

The tactic works! The elves are level. The score is 1-1 and the game goes into extra time.

Advent Challenge 5 - Beginner.xaml (7.7 KB)

Advanced

In extra time, team Santa wins another free kick. This time, Santa notices a weakness in the rabbits’ wall formation. There is some duplication in their player marking, which creates a defensive weakness. If only the duplicate can be found out, Santa’s team can convert the second free-kick as well.

Ronaldinho comes up with another master-stroke - a simple query that eliminates duplicates from a datatable.

image

With this insight, the Brazilian wizard steps forward to take the kick.



GOOOOOOOOOOOOOOOOOOOOOOOL!

The crowd goes wild! Thankfully, Santa’s team clinches the game 2-1. Thank god for Ronaldinho’s two queries. It would have been embarrassing to lose a home game in the Christmas season.

Advent Challenge 5 - Advanced.xaml (9.3 KB)

2 Likes

:fire: Advanced:

This time Santa ready to swing his tennis racquets and decided to play with the kids…And he had planned to share the gifts after the tennis match…

Santa decided to play :two: sessions and One in the morning :sun_with_face: and one in the evening. :sun_behind_large_cloud:.When he saw the list he realized that the some kids have been registered twice…

Santa :santa: needs to help from the Robot :robot: to identify the kids registered for both the sessions…Robot :robot: delivered the result quickly

Santa is happy and Satisfied the kids wishes as promised…

image

XAML : Advent_Challenge5_Advanced.zip (55.2 KB)

3 Likes

Advanced.

Santa :santa: was selected for the Football :soccer: Club Barcelona in the month of October 2020.

And Today’s Match with Real Madrid has been tied with the Score of 0-0

But the Match Referee has decided for Penalty Shootout

Because In a penalty shoot-out, each team takes turns shooting at goal from the penalty mark, with the goal only defended by the opposing team’s goalkeeper. Each team has five shots which must be taken by different kickers.

But here is the problem with Santa’s players list. because the player’s list is messed up that santa :santa: was supposed to use for the Penalty Shoot-out due to some mistakes made by the new version of the list.

And now Santa :santa: is in big trouble :roll_eyes: :roll_eyes:. because Santa :santa: is not able to decide which player he will send for the Penalty Shoot-out asper their shoot-out skills because there are some duplicate names present in the list.

But suddenly Santa :santa: get an idea :bulb: and he decide to discuss this problem with Magician Messi :star_struck: :star_struck: :star_struck: :heart_eyes: :heart_eyes: because Messi is a Captain of the Barcelona Team.

download

And Messi has a plan for this problem.

And he will be using his some Dribbling Skills to get a rid from this problem.

Messi decide to first merge both the files A and B after extracting the folder and then he will get the merge players names in the new File.
Extract_Zip_Folder

Merge_Files

Then Messi read the Merge file.

After reading the Players Name list from Merged File for penalty shoot-out, he found that there are some duplicate players name.

And suddenly he got an Idea to remove all the duplicate players name with the help of his Magic. because he is the Magician :tophat: of football :soccer:.

Remove_Duplicates

here is the complete Magic flow of Messi the GOAT.

Workflow 1

Workflow 2

Wishlist_Workflow_2

After Successfully removing the duplicate Names. Messi show the final Player’s Names to the Manager Santa :santa: :santa:
Get_Kids_Names

Here is the Player’s Name:

Wishlist_Names_Output

Now, Santa can easily decide which player will go first for the Penalty Shoot-out. :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: And he is also very confident that his team will surely win the game against Real Madrid

Luis-Suarez-has-previously-taken-penalties-for-Barcelona-1829664

:heart: :heart: :heart: :heart: :heart: Always

Barca Love
Cg-jD11UYAQjNiW
AdventChallenge_5_Advanced.zip (36.5 KB)

Beginner

After a Match Santa :santa: told Messi to delete the Mess file also which will be the latest modified file.

Messi accepted the new challenge again because he is a G.O.A.T and he loves challenges. :wink: :wink:
A--PSryCQAAUkeL

And now he will be using detailed pass map :world_map: to get the latest player’s name file list Date Time.

Let’s see the Messi’s Passmap workflow for deleting the latest file.

Workflow 1
DeleteFile_Beginner_WF1

Workflow 2
DeleteFile_Beginner_WF2

After using his magical power, he has deleted the latest created file (Highlighted in Red Underline).

LatestModifiedFileDateTime_Output

Advent_Challenge_5_Beginner.zip (23.7 KB)

5 Likes

Advent Challenge #5 Beginner

Santa is sitting at home and watch the Muppets sport show. He is angry about Jingle-Bell, his assistant. Such mistakes should not happen, he thinks. There we are doing Scrum and working agile and still it happened, so close to Christmas. Santa admonishes Jingle-Bell, don’t do that again boy.

image

Santa decides to develop an Invoke Code activity to solve the challenge. So he starts the editor and develop a tiny code sequence.

image

After the developing and testing he transfers the code sequence to the Invoke Code activity.

The code is very easy to unterstand. Santa creates a data table and stores all Excel files from the current directory in it. He sorts the table according to the creation date. In the last step he deleted all Excel files with the exception of the youngest, which has been created last.

//-Begin----------------------------------------------------------------

string Dir = Directory.GetCurrentDirectory();

DataTable FileList = new DataTable(); 
FileList.Columns.Add("FileName");
FileList.Columns.Add("FileDateTime");

try {
  string[] Files = Directory.GetFiles(Dir, "*.xlsx");
  foreach(string File in Files) {
    DateTime FileCreationDate = Directory.GetCreationTime(File);
    FileList.Rows.Add(new object[] { File, FileCreationDate });
  }
  FileList.DefaultView.Sort = "FileDateTime ASC";
  FileList = FileList.DefaultView.ToTable();
  long i = 1;
  foreach(DataRow row in FileList.Rows) {
    if(i > 1) {
      File.Delete(row["FileName"].ToString());
      Console.WriteLine("File deleted: " + row["FileName"].ToString());
    }
    i += 1;
  }
} catch(Exception ex) {
  Console.WriteLine(ex.Message);
}

//-End------------------------------------------------------------------

All works well and expected. Santa feels good and watches more sports. An interview with Gonzo. Santa wonders himself what he would look like with that nose.

image

3 Likes

Advent Challenge #5 Advanced

Santa is a poor man, nothing has changed since Challenge #3. No Office and no Excel is available. So Santa has to convert the worksheets into CSV, in his opinion the better format anyway.

Santa wants to laugh, so he watches the comedians Laurel and Hardy, in sports activities. First the men’s ballet. How gracefully he thinks.

Santa codes a tiny Invoke Code activity to transfer the content of the CSV files into a new data table. The code is easy to understand. A loop over all CSV in the directory and the content of each CSV is added to a new data table.

//-Begin----------------------------------------------------------------

KidsWishes.Columns.Add("Kid");
KidsWishes.Columns.Add("Wish");

string[] Files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.csv");
foreach(string file in Files) {
  var lines = File.ReadLines(file);
  foreach (string line in lines) {
    if(line != "Kid;Wish") {
      KidsWishes.Rows.Add(new object[] { 
        line.Split(new string[] { ";" }, StringSplitOptions.None)[0],
        line.Split(new string[] { ";" }, StringSplitOptions.None)[1]
      });
    }
  }
}

KidsWishes.DefaultView.Sort = "Kid ASC";
KidsWishes = KidsWishes.DefaultView.ToTable(/*distinct*/ true);

//-End------------------------------------------------------------------

Proud is Santa. With two commands of the DataTable class he sorts the table and deletes the double entries.

With the Write CSV activity Santa saves the corrected content.

image

image

Last but not least Santa is watching men’s couple dancing. It’s like the dance of the decoration on our Christmas tree.

7 Likes

@StefanSchnell I love your invoke code solutions!

Since the challenge is simple and easy to follow, it gives people like me a basis to follow how code snippets achieve in a small space what we otherwise use UI based workflows for.

3 Likes

Some nice and interesting solutions here… But Grumpy will just do the work here.
Grumpy likes it simple (like version control in UiPath!)

Just let Jingle-Bell give grumpy the two packed lists, and Grumpy will make a brand new list for Santa to use!



There! All done!
And the next time you do this, just use this workflow yourself! Easy!
Grumpy.xaml (39.3 KB) project.json (1.5 KB)

2 Likes

Thank you very much @anupamck :grinning:

2 Likes

:snowflake: Beginner & :fire: Advanced

Once upon a time, in a faraway land a lovely family lived in a swamp.
One day something unexpected happened…
donkey

It was a shock especially for Sherek
sherek

Fortunately, was cat in boots :cat2:
cat

Cat created the solution for beginner level :

result

And then …

And Cat in boots also created the solution for advanced level :

result advanced

And everyone lived happily ever after :blush: :santa: :christmas_tree:

all

3 Likes

Im not sure if other people wondered. Where is Santa!!! Sure did not read in the challenge where he is…

Must be still “Shopping for Gifts”

He must be going in circles due to the duplicate names in his list… that is why he decided not to land anywhere.

image

But, as per Advent 4 Challenge, We all know where Santa went. Wink Wink

Here it goes!

Due to Santa Saving up for the Holidays… Santa did not buy a license for a trusty version control system. Because of that… He is currently lost in the air until he finds a solution…

So Santa, called his old friend to fix the problem…

Finally, the Rock has come back to help Santa Claus

Solution for ADVANCE

After a very long speech of the rock making fun of Santa using an excel file to store the names and gifts for the elves. He HURRIEDLY helped Santa to merge the files and find the duplicates

Get it? Hurriedly = Faster hahahaha ;p ;p ;p

So the rock created a data table first, then read both Wishes A and Wishes B.
The rock then merged the output of both Data table A and Data Table B into One.

image

Upon Merging, he suddenly removed the duplicates then sorted the data table

image image

image

image

This gave a quick Victory for the Rock!

Suddenly, Santa called again, but the rock is too tired. So the rock asked his friend to help Santa with his next task

Beginner Solution

The rock then call Maria! He Said, Maria, if you help Santa. I will give you front row tickets to my next movie :smiley: :smiley: :smiley:

Maria was so delighted she had to close her fist and smile and open her mouth to show her enthusiasm

She then said “Just Bring it!”

image image

So the rock told Maria Sharapova of Santa’s issue and would like to delete the latest file based on creation date.

Maria Sharapova had to think for 1 minute and 03 Seconds

but nothing came out… so she asked for 2 Minutes more :smiley: :smiley: hahahaha

Then she realized the solution. So she said! Game on Santa!!

She through the solution right of the Bat!!! I mean Tennis Racket

It was a very hard swing!

So, she said Santa, i will compare both files using files.getcreationtime to solve your problem.

And I’m Going to use Multiple Assign!!! (She said very proudly as if Santa will be impressed)

After that i will be able to get the date and other timestamp parametes in the file… trust me i will

image


Then she ran the code… Then the output came out :smiley: :smiley:

image

The she told Santa… you trust me now?

image

And that is the story of how the Rock and Maria was able to help Santa.

by the way…

We managed to find where Santa went.

we saw him somewhere in the UiPath Reboot Work Festival… Must be inside the big tent

Or maybe inside the Souvenir Shop

Looking forward to the next Advent Challenge!

-Sean

5 Likes

Ho ho hoo…Mary Christmas

:evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree: :evergreen_tree:

If you wish to watch my Santa Story the

Episode #1 ==> :snowman_with_snow: Advent Challenge #1

Episode #2 ==>:Santa: Advent Challenge #2 (Everyone welcome to join the event!) - #36 by Maneesha_de_silva

Episode #3 ==> Advent Challenge #3 - #39 by Maneesha_de_silva

Episode #4 ==> Advent Challenge #4 - #39 by Maneesha_de_silva

:star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck: :star_struck:

Welcome to my Santa Story Episode #5 (Beginner & Advanced Challenge Inside)

:point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right: :point_right:

Santa Suddenly heard that lady was crying… Santa was wondering who is she … sounds like very familiar who may be … :thinking: :thinking: Is that @Luiza :thinking: :thinking: :thinking: :thinking: :wink:

Santa ran to the next room and opened the door
unnamed

OMG… Its Jingle-Bell…

Santa: oh my lady what happened? why are you crying? , have you seen any ghost ( My Episode #4 )
Jingle-Bell: No… eh eh eh…
Santa: So why are you crying then?
Jingle-Bell: I made a terrible mistake eh eh eh…

                    Again She was crying loud......

Santa: Its ok dear tell me what happened, we need to hurry we are almost late now
Jingle-Bell: your wishes excel … eh eh eh…eh eh eh…
Santa:: Ok ok then… what happens…
Jingle-Bell: wishes excel has been edited by mistake and now there are duplicate and also i cannot find what i have last created eh eh eh…
istockphoto-153388297-612x612 Jingle-Bell is really upset about it …

Suddenly Santa start laughing
Capture.PNG

Jingle-Bell was angry about that
Capture2.PNG
why are u laughing now, you know want you have lost all wishes and now you are laughing

Santa: You know what, don’t worry my dear… Last year I have modified my Sleigh
with few technologies, I can do my most of the thing on my Sleigh Dashboard don’t worry lets go into my Sleigh

Now You Wondering About The Sleigh DASHBOARD Isn’t it
here we go …

Then Santa access his Sleigh Dashboard and made a new file by removing duplicate
File Name: Kids Wishes Secure.xlsx
Advanced Challenge :
Duplicate Remove Configuration Module : Main.xaml (6.4 KB)

Beginners Challenge :
Main.xaml (9.6 KB)

UiPath APP File: GitHub - manee4422/UipathAPP-Challange5


The below Video show you that How Santa’s Sleigh Dashboard will work

Function: Data Rettriving by Unattended Robot and Sending the Information to UiPath APP and Display via UiPath App With some artificials/By the button of commanding Unattended robot running the process to delete the file :stuck_out_tongue_winking_eye:

6 Likes

Dear Santa,
So glad to hear that assistant Jingle-Bell got a personal digital coworker that can do the boring job to assembly all the scattered wish lists into one with unique wishes.
Now Jingle-Bell can play paddle with his kids instead.
#Challenge5 #Advanced
Main.xaml (13.0 KB)
Padel

4 Likes

Advanced

Santa needs the mess that Jingle-Bell accidentally made. UiPath bots as always are here to help
Excel Manipulation are so easy with UiPath and here is the workflow


And here is the execution outcome
Image1
Santa is happy that the mess was cleared in no time.
AdvancedChallenge_5.xaml (9.0 KB)

6 Likes

We figure out why Jingle-Bell not using source control: he was in love

I am more than happy to help him with 2 different approaches to his problem.
I have posted here a YouTube video about this: https://www.youtube.com/watch?v=0WPCa70HgUE

1 Like