I’m trying to retrieve date field from Mainframe. Usually if the date is available means it will appear in the ddMMyyyy format and date not available means it will appear like this _______
I have extracted the date field by using get field text activity with length of 8 and it will extract the date field even though date field does not have values.
After retrieving date from the mainframe I’m converting into datetime format with this condition
DateTime.ParseExact(Datevariable.ToString.Trim,{“ddMMyyyy”,“dd/MM/yyyy hh:mm:ss”,“yyMMdd”}, System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None)
The above condition working for three different date formats and I’m getting error for _______ date filed value.
Kindly assist me how can we eliminate the empty date field values in the above condition.
@shyamala_shyamu what output are you getting in your get text? if it is empty then you can check if variable IsNot nothing. If you’re literally getting “_____” then you can do variable contains “___” based on that you continue forward or stop your process
I’m getting “_____” so I have used contains method only to stop the process. It actually falls under that if condition and successfully executed. After completing the If condition bot need to update the status in the excel file.
In my case there are so many scenario available based on the date, so I have Created one common array variable and stored it in data table. here will have multiple condition check based on the date. Condition met in this case but again it’s going to check another IF condition so this will causing problem.
Just put an If and check when the value is _____ (or blank/empty). If it is, do nothing (or whatever you need to do) and if it’s not blank then do the ParseExact.