Rhys18
(Rizky Albert Hartono)
May 28, 2022, 10:52am
1
Hi,
I got an activity like this :
My company have 2 type of insurance (Insurance A and Insurance B)
Each customer can have different insurance period (example John Doe having 3 year of insurance period, and Jane Doe having 4 year insurance period)
And each customer can have 2 type of insurance in their insurance period, example :
John Doe : 3 Years insurance
Year 1 : Insurance A
Year 2 : Insurance B
Year 3 : Insurance A
Jane Doe : 4 Years Insurance
Year 1 : insurance B
Year 2 : Insurance A
Year 3 : Insurance A
Year 4 : Insurance A
I need to output what year does the customer having Insurance A. So the output will be :
John Doe : Insurance A (Year 1,3)
Jane Doe : Insurance A (Year 2,3,4)
I alrd got the year, and the insurance type, but I don’t get the logic on the if section. Can any1 help me with this automation?
Srini84
(Srinivas)
May 28, 2022, 2:44pm
2
@Rhys18
But it’s not clear what was your input?
Thanks
Rhys18
(Rizky Albert Hartono)
May 28, 2022, 2:46pm
3
So far I haven’t do anything yet with the if because I don’t get the logic how to output it. The only thing I think of is nested if, but the consequences the robot will be heavy because there’s a lot of process (if its 8 insurance period, then its 7 if inside an if)
Srini84
(Srinivas)
May 28, 2022, 2:48pm
4
@Rhys18
Can you tell us what was the input or which variable you are storing this info?
Thanks
Rhys18
(Rizky Albert Hartono)
May 28, 2022, 2:52pm
5
The variable I am storing is 2
Year : Contains Tenor Year (1, 2 ,3)
Ins_Type : the insurance type (Insurance A, Insurance B)
Srini84
(Srinivas)
May 28, 2022, 2:54pm
6
@Rhys18
Has your Input come from Excel?
Thanks
Rhys18
(Rizky Albert Hartono)
May 28, 2022, 2:55pm
7
The input is coming from a filtered json. So I query the insurance detail with SQL query activity inside the uipath, and filtered it with json to data table activity then I pass it to a variable like this
jpbelchote
(João Pedro Oliveira Belchote)
May 28, 2022, 5:39pm
8
I’m not too familiar with filtered json or the data structure you’re using, but for variables, it fits in a dictionary. The key would be the Employee name and the value would be another dictionary <insurance;year> pair of key/value.
You could use loops to print the years of insurance A and B by populating a string array inside a ‘for each’ loop, it would probably look like this.
Rhys18
(Rizky Albert Hartono)
May 29, 2022, 10:29am
10
I tried ur solution and somehow it keeps adding when I use string.join function the output is like this :
Expected Output
John Doe : Insurance A (Year 1,3)
Jane Doe : Insurance A (Year 2,3,4)
System Output
John Doe : Insurance A (Year 1,3)
Jane Doe : Insurance A (Year 1,3,2,3,4)
Have tried clear collection, remove data table at the end of the process it’s still not working somehow
Rhys18
(Rizky Albert Hartono)
May 29, 2022, 10:52am
11
Thanks for ur help !!
I stored the variable in a dictionary, using if inside it for the insurance, then at the very early I declare a variable and put the value as :
Ins_Var = “”
and the output is expected as I want. Thank you so much !
1 Like
jpbelchote
(João Pedro Oliveira Belchote)
May 29, 2022, 3:19pm
12
I’m glad I could help you! Thanks for marking it as solution!
Rhys18
(Rizky Albert Hartono)
May 29, 2022, 3:20pm
13
Thanks a lot and your welcome ! Hv a nice day
system
(system)
Closed
June 1, 2022, 3:21pm
14
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.