How to get the Previous month latest entr date in MF?

Hi all i have requirement which was i have the data in excel sheet and i have imported to one entity and in that excel sheet i have the project and dateand time attribues , for each pirticular project i have the different date     now i have to bring the latest date data entry the problem is for ex: i have the latest date of dec-15 in that i dont have the data so i have to pick nov-22 date can i acheive this in MF what i have did is i just retrive list and after i used filter by expression in that i passed this list and in expression i have passed *currentobject/datetime=[beginof month]-1 its not works well.   please is there any approach to bring the data.
1 answers

If you have a list of objects with a date and you need to retrieve the lastest record based on the date attribute, you can do this with a query. Just a a retrieve from database. Make sure the custom setting is used to retrieve just 1 record (amount ==1). The set the sorting in the retrieve action to the datetime attribnute and make sure the sorting is done descending. This will result 1 1 record with the largest value for the date field.


The option with the list could also work, just create a variable as datetime with the value addMonths(beginofcurrentMonth, -1) and use this variable in the list find action. Better would be to do the same sort of thin in the retrieve from database by using the created variable in the xpath database retrieve action. This last option will perform much better certainly if you are dealing with large lists as you just retrieve 1 record in stead of a list of all records.