hey, im a new RPA developer and i have encountered an issue with where.function(x) function…
i tried couple of things but couldnt succeed…
i have Jobject with jason arrays inside him. the Jobject is a person and in the Jobject theres all the details about him.
so i have:
Jobject → childrenUnder21 → childrenDetails → name, lastName, birthDay, familyStatus
i want to check if the child is under the age of 21 and that he is single.
im using “for each” activity and in the condition i wrote this:
But kindly note: days / 365 will ignore the leap years, now.Year - Birthday.Year > 21 will ignore if the birthday is before now or later within the year.
With the help of the Query syntax we can do:
listMajors =
(From x In myJObject("childrenUnder21")("childrenDetails").Values(Of JObject)
Let dob = x("birthDay").Value(Of DateTime)
Let age = now.Year - dob.Year - Convert.ToInt32(now.Date < New DateTime (now.Year, dob.Month, dob.Day).Date)
Where x("familyStatus").toString.ToUpper.Equals("SINGLE") And age > 21
Select p=x).toList