Situation:- We have a file of records that include a date field. We need to identify the latest/highest date listed in the source file and store that date in a context variable to be used later in a process flow.
Solution:- We cannot compare the date field in the mapping and find the max date from the mapping. The max function in the mapping only works for the number and String. Below is the reference for the same:-
Currently, there is no such way to find the highest date in the single mapping. It would be better if we use the sorting function in first data mapping activity to make the record to sort on the basis of date. After sorting, the first record should have highest/latest date (sort on the basis of descending order). Once you have the highest date then you can use second data mapping activity to pull the value from the first record.
Also, if you need to fetch the value of this date in the context variable then you can place the context schema at that target of second mapping. You can utilize the value by using "$$ContextVariableName$$" in the Put-Context-Var activity of the Process Flow.