Hi Vinod,
I will suggest you few approaches where the first two approach deal with making these values null within the collection itself before writing it into excel while the last approach can be used if you have written the data in excel as you are doing now. The last approach works within the excel file itself.
Approach I:Have you tried to check with column data type as Text instead of DateTime in the collection before writing it to the excel. There are multiple ways to do that as one way can be to create a similar collection with defined fields just keeping the date time field as text type and then using a calculation stage just set the new collection value to old collection.
Approach II:
Another way can be to use a custom action to change the data type of the column to text and then write it to excel for which I think I posted a thread as well while back.
Let me know in case you can't find that action, I can help you with that.
NOTE: In either of the two approaches if while converting the data type of the collection field, you get unwanted value as "01-01-0001 00:00:00", then you can replace this value with null throughout your collection.Approach IIII:Last approach would be to do this in the excel file itself, where you can use a custom action to execute the replace functionality. You just need to extend the 'MS Excel' VBO or 'MS Excel - Extended' VBO by creating a new action called
'Replace' with following input and output arguments:
Add a page reference stage to '
CheckInstanceAndWorkbook' page as shown below:
And now you can use a code stage with following parameters:
Code:
wb = GetWorkbook(Handle, Workbook)
ws = GetWorksheet(Handle, Workbook, Worksheet)
wb.Activate()
ws.Activate()
excel = ws.Application
sheet = excel.ActiveSheet
Try
Success = True
ws.Range(range).Replace(What:=findString, _
Replacement:=replaceString, _
LookAt:=1, _
SearchOrder:=1, _
MatchCase:=False, _
ReplaceFormat:=False)
Catch e As Exception
Success = False
Message = e.Message
Finally
wb = Nothing
ws = Nothing
excel = Nothing
sheet = Nothing
End Try
Now you can simply use an action stage and call this action once published from Process Studio by supplying the workbook name, worksheet name, handle and range along with find string as
"00:00:00"
and the replace string as
""
It will replace all the cells having the 12:00:00 AM value to null.
NOTE: Ensure that while using any action related to Excel (i.e, Create Instance, Open Workbook, Close Instance) you are using the same business object where you have created this custom action. If not, then you will get a bad handle exception.------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future
Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website:
https://devneet.github.io/Email: devneetmohanty07@gmail.com
----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.