cancel
Showing results for 
Search instead for 
Did you mean: 

Compare and get Least value

polinenileela_b
Level 4
Hi Folks  , Thanks in Advance . In my process I will get 5 Date of Births from 1 application , and I have 1 date of birth read from different application. Now I have to get the date from 5 Date of Births that is near to  1 Date of Birth . Or I have got my difference collection ( I mean difference number that was subtracted from one dob to 1 of the 5 DOB ) . I want to get the least number from that . Please help with this . If code stage please help with code as I tried not working. Thanks Eagerly Waiting for response
3 REPLIES 3

John__Carter
Staff
Staff
Create a data item called NearestDOB with an initial value something like 01/01/1900. Then compare d0 (date from first app) with d1 (first date from other app). If d1 is closer to d0 than NearestDOB (which it will be the first time) then set the value of NearestDOB to be d1. Repeat for d2, 3, 4, 5.

polinenileela_b
Level 4
Hi John ,   Thanks for your response, But I cannot initialize the year because the year may be like 00/00/1975 (example) , year May change even to 1800 also , So if possible please help according to this.   Thanks Leela

John__Carter
Staff
Staff
Well if the system can values that aren't dates, like 00/00/1975, then you'll need to detect them and assume a valued date, eg 01/01/1975. The baseline value of NearestDOB just has to be something that is a great distance from d0, eg 01/01/9999.