You are viewing limited content. For full access, please sign in.

Question

Question

Date Token Calculator is showing an incorrect date format while running the workflow

asked on November 3, 2015

Hi all,

I have a number field, named as Calculated Year and a date field named as Date Received. I want to do a calculation on these two fields and store it in a Expected Date field. For instance, Date Received= 03/11/2014 and Calculated Year= 1. The Expected Date field will be 2015 as i want to extract the year part from the Date Received and add it up with the Calculated Year (i.e. 1) and the Expected Date field will return 2015.

 

I have used the Date Token Calculator and opt the Specific date and add the RetrieveFieldValues_Calculated Year. But, I am having an error like 'incorrect date format'. Can you please advise about the error?

 

Thanks

 

 

0 0

Answer

SELECTED ANSWER
replied on November 4, 2015

Your date formatting seems to be wrong for month and day. "%M" and "%d" should be just "M" and "d"

0 0

Replies

replied on November 3, 2015 Show version history

Hello Sheila, 

Try to use "Pattern matching" activity to retrieve the year , it could be in Idea 

The process is not to Clear for me but i suggest  : 

Date 1 : 03/11/2014

Expected Date =2014 +1

 

Pattern Matching 1 (day/Month) = 03/11     :   ([0-9]*/[0-9]*/)

Pattern Matching 2 (year) = 2014  [0-9]*/[0-9]*/([0-9]*)

Token Calculator = Pattern matching 2 + 1

Expected Date = Pattern matching 1/Token calculator 

 

Hope that this coan help you 

 

Best regards 

0 0
replied on November 3, 2015 Show version history

Ahmed's version works, but I think there's a better way to do this. (although the pattern will fail unless you put 2 //'s where you need it to actually find a '/' !)

 

I always use this as my base pattern extractor (if it's coming from an OCR)

[0-9]{1,2}\s?//\s?[0-9]{1,2}\s?//\s?[0-9]{2}[0-9]{0,2}

the reason I use the above is that coming from OCR it's very common for extra spaces to appear around the /'s. 

 

I then add () around each of the areas I'm trying to grab in a date field... 

 

 

I usually make this a 2 step process and save the extracted date, then create another date field to make it +1 year

 

 

The other gotcha with this is that if you use a token to add a year, you need to make sure that token is a integer. 

 

 

 



 

 

 

 

0 0
replied on November 3, 2015

Is Calculated Year a number or integer field in Laserfiche?

0 0
replied on November 3, 2015

Calculated Year is a number field in LF.

0 0
replied on November 3, 2015

I am getting this error message 'Input string was not in a correct format'.

 

Thanks to advise

0 0
replied on November 4, 2015 Show version history

Hi all,

I used the Apply Formatting and extracted the date part into separate day, month,year.

0 0
SELECTED ANSWER
replied on November 4, 2015

Your date formatting seems to be wrong for month and day. "%M" and "%d" should be just "M" and "d"

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.