Date Variable Error

Hi All,

I am trying to convert string 07/02/2018 to date using new date variable. Appreciate the help.

I am getting below error - Text ‘07/02/2018’ could not be parsed, unparsed text found at index 8

Log :
Error executing DateFormatAction
com.workfusion.studio.rpa.recorder.playback.PlaybackException: Error executing TemplateAction[templateName=DateFormatAction.ftl,id=27,name=Optional[DateFormatAction],parent=-2,nextSibling=28,arguments=ActionArguments[outputLocale=[en-US],input=[${campaign_submit_date}],outputMask=[dd/MM/yy],targetVariable=[reform_string],delay=[0],inputLocale=[en-IN],xsi:type=[recorder:DateFormatAction, recorder:DateFormatAction],pollingInterval=[300],active=[true],inputMask=[dd/MM/yy],direction=[STRING_TO_STRING],awaitTimeout=[5000]]]
at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:54)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:30)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:17)
at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:53)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:153)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:113)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.time.format.DateTimeParseException: Text ‘07/02/2018’ could not be parsed, unparsed text found at index 8
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1952)
at java.time.format.DateTimeFormatter.parseBest(DateTimeFormatter.java:1897)
at com.workfusion.studio.rpa.recorder.api.internal.representation.RDateTimeRepresentation$CustomRepresentation.parse(RDateTimeRepresentation.java:137)
at com.workfusion.studio.rpa.recorder.api.internal.representation.RDateTimeRepresentation.getValue(RDateTimeRepresentation.java:50)
at com.workfusion.studio.rpa.recorder.api.types.RDateTime.fromRepresentation(RDateTime.java:51)
at com.workfusion.studio.rpa.recorder.api.types.RDateTime$fromRepresentation.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at Script23.run(Script23.groovy:4)
at com.workfusion.studio.rpa.recorder.playback.shell.GroovyShellWrapper.executeScript(GroovyShellWrapper.java:90)
at com.workfusion.studio.rpa.recorder.playback.player.PlaybackContext.executeScript(PlaybackContext.java:65)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.executeBehavior(TemplateAction.java:35)
at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:46)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:30)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:17)
at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:53)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:153)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:113)
at java.lang.Thread.run(Thread.java:745)

Thanks,
Narendra

Hi Narendra,
Please check that you have the correct input format in the action.

Hi,

Still getting same error. Trying to convert string 07/02/2018 to date format.

Thanks,
Narendra

Could you please share your recording here? We’ll have a look.

Hi,

Attached is the recording.

Regards,
Narendra date.zip (943 Bytes)

I guess the problem is that you copy the date from Excel, and it is presented there in some custom format.
You can see the correct format in the error details.
image

In this case you need to adjust the input string format to it, i.e. yyyy-MM-dd HH:mm:ss for the image above.

Error executing DateFormatAction

com.workfusion.studio.rpa.recorder.playback.PlaybackException: Error executing TemplateAction[templateName=DateFormatAction.ftl,id=6,name=Optional[DateFormatAction],parent=5,nextSibling=7,arguments=ActionArguments[outputLocale=[en-IN],input=[${row[1]}],targetVariable=[conv_date],delay=[0],timeoutMs=[10000],inputLocale=[en-IN],xsi:type=[recorder:DateFormatAction, recorder:DateFormatAction],pollingInterval=[300],active=[true],inputMask=[MMM dd, yyy],awaitTimeout=[5000],direction=[STRING_TO_TYPE]]]
at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:54)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:28)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:15)
at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:81)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:154)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:112)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.time.format.DateTimeParseException: Text ‘1/6/2018’ could not be parsed at index 0
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
at java.time.format.DateTimeFormatter.parseBest(DateTimeFormatter.java:1897)
at com.workfusion.studio.rpa.recorder.api.internal.representation.RDateTimeRepresentation$CustomRepresentation.parse(RDateTimeRepresentation.java:140)
at com.workfusion.studio.rpa.recorder.api.internal.representation.RDateTimeRepresentation.getValue(RDateTimeRepresentation.java:53)
at com.workfusion.studio.rpa.recorder.api.types.RDateTime.fromRepresentation(RDateTime.java:104)
at com.workfusion.studio.rpa.recorder.api.types.RDateTime$fromRepresentation.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
at Script6.run(Script6.groovy:8)
at com.workfusion.studio.rpa.recorder.playback.shell.GroovyShellWrapper.executeScript(GroovyShellWrapper.java:48)
at com.workfusion.studio.rpa.recorder.playback.player.PlaybackContext.executeScript(PlaybackContext.java:108)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.executeBehavior(TemplateAction.java:33)
at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:46)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:28)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:15)
at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:81)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:154)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:112)
at java.lang.Thread.run(Thread.java:745)

@dhaya it looks like you have incorrect input string format in the action.
You can check the correct format in the execution result log file.

thank you @ashapkina

1 Like

here see the col list the exact format of the date(string) in my excel


i tried to convert each element in col list from string format to date

here i got error like this

You use a wrong date format . It need to be like this.

image

mam i do not have this format in my workfusion

There are some predefined formats in the action, but you can use your own.

You can write the format manually: yyyy-MM-dd HH:mm:ss


i have got this error

Looks like the variable you are trying to convert is empty. You can use exception handling for such cases.

Hello @ashapkina, how are you?
Pleade I need help with a very similar problem, but in the execution log file the format of the date is dd/MM/yyyy and that is the format I put in the input format. Here is the error
Error executing DateFormatAction
com.workfusion.studio.rpa.recorder.playback.PlaybackException: Error executing TemplateAction[templateName=DateFormatAction.ftl,id=116,name=Optional[DateFormatAction],parent=109,nextSibling=117,arguments=ActionArguments[outputLocale=[es],outputMask=[dd/MM/yy],inputLocale=[es],xsi:type=[recorder:DateFormatAction, recorder:DateFormatAction],pollingInterval=[300],active=[true],inputMask=[dd/MM/yyyy HH:mm:ss],input=[${fecha_desde}],targetVariable=[fecha_string],delay=[0],timeoutMs=[10000],awaitTimeout=[5000],direction=[STRING_TO_STRING]]]
at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:54)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:28)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:15)
at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:81)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:154)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:112)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.time.format.DateTimeParseException: Text '13/01/2020
’ could not be parsed at index 10
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
at java.time.format.DateTimeFormatter.parseBest(DateTimeFormatter.java:1897)
at com.workfusion.studio.rpa.recorder.api.internal.representation.RDateTimeRepresentation$CustomRepresentation.parse(RDateTimeRepresentation.java:140)
at com.workfusion.studio.rpa.recorder.api.internal.representation.RDateTimeRepresentation.getValue(RDateTimeRepresentation.java:53)
at com.workfusion.studio.rpa.recorder.api.types.RDateTime.fromRepresentation(RDateTime.java:104)
at com.workfusion.studio.rpa.recorder.api.types.RDateTime$fromRepresentation$2.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
at Script20.run(Script20.groovy:8)
at com.workfusion.studio.rpa.recorder.playback.shell.GroovyShellWrapper.executeScript(GroovyShellWrapper.java:48)
at com.workfusion.studio.rpa.recorder.playback.player.PlaybackContext.executeScript(PlaybackContext.java:108)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.executeBehavior(TemplateAction.java:33)
at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:46)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:28)
at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:15)
at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:81)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:154)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:112)
at java.lang.Thread.run(Thread.java:745)