Posted Fri, 05 Jan 2018 19:43:09 GMT by Teresa Younts Word-Tech Application Support Specialist

I have a Date field that is populated from a database with a Date field in the MM/dd/yyyy format.  In a Workflow Engine email I need to present that date to users in another country as dd/MM/yyyy.  Does anyone know of a way to convert a date with an Arithmetic expression or something that will flip the dd and MM fields?

I have a way to do it by creating multiple global variables for Full Date, Month, Day and Year, Reformatted Date.  I can then convert my date to a string, piece it out with Split expressions and then put it all back together in a Global Variable to be inserted into my email but a convert statment of some sort would be much easier. 

 

Posted Mon, 08 Jan 2018 20:58:00 GMT by Christopher Ure Software Support Analyst

So, date format is controlled by a particular user's web client's regional settings. I have not had the oppertunity to test this, but if you create a special user with the appropriate regional settings, and make that user the "service" user for a copy of your existing workflow (configurable in the start activity), I think that should generate the dates in the proper format.

This particular method will of course require a way to differentiate between customers in different regions to prevent multiple workflows being triggered by the same document.

Edit: This doesn't work as I thought it might, unfortunately; however, Phil's response below will certainly format it in the manner you are looking for.

Christopher Ure

Software Support Specialist

Support Team GREEN - Americas

Posted Mon, 08 Jan 2018 21:36:54 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

Try this:

Create GV_EuroDate as a string variable, and the GV_USDate as a date variable.

GV_EuroDate = Format(CSTR(GV_USDate),"dd/MM/yyyy")

 

Phil Robson
SEnior Director Support - Americas

Posted Tue, 09 Jan 2018 17:31:27 GMT by Teresa Younts Word-Tech Application Support Specialist

This would be so much simpler if I can get it to work.

In my workflow I populated the USDate from an index field and it returned a result of 1/9/2018 12:00:00 AM as expected.

Trying to populate the EuroDate string from that result using the Format statement returned mm/DD/yyyy instead of the actual value.  Did I not set this up correctly?  Workflow setup screenshot uploaded.

 

https://www.docuware.com/sites/default/files/forums-images/Workflow%20Setup.png

Posted Tue, 09 Jan 2018 17:40:35 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

Teresa,
Let me test the syntax and come back to you.

 

Phil Robson
Senior Director Support - Americas

Posted Tue, 09 Jan 2018 17:44:38 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

The syntax is correct. Can you give me a screen shot of the actual expression?

 

Phil Robson
Senior Director Support - Americas

Posted Tue, 09 Jan 2018 17:51:43 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

I know what is wrong. You are assigning both variables in a single data assignment task. There is a good chance that the date format conversion is operating on an empty string. I suggest that you make 2 data assignment steps. The first one assigns the Date from the file cabinet to the GV_USDate variable. Then the second data assignment step does the format:

This is the code to use:

GV_EuroDate = Format(Cstr(GV_USDate),"dd/MM/yyyy")

Then you can be sure that it is not trying to format an empty string.

 

Phil Robson
Senior Director Support - Americas

Posted Tue, 09 Jan 2018 18:24:00 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

Ok, I tested it in a workflow and it works. However, oddly enough it does not like converting the USDate to a string. so omit that and just use this:

Format(GV_USDate,"dd/MM/yyyy")

See screen shot. Converted date is in the Subject field.

 

 

https://www.docuware.com/sites/default/files/forums-images/EuroDate.png

Posted Tue, 09 Jan 2018 19:02:42 GMT by Teresa Younts Word-Tech Application Support Specialist

Hello Phil,

I created two different data assignment steps.  Still get mm/DD/yyyy.

Here is what I have done.  

 

https://www.docuware.com/sites/default/files/forums-images/Workflow%20Setup2_0.png

Posted Tue, 09 Jan 2018 19:08:21 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

Remove the CSTR as per my last post.

Just use this:

Format(GV_USDate,"dd/MM/yyyy")

Also uncheck the validate box. You can't validate this type of expresion.

That should do it.

Posted Tue, 09 Jan 2018 19:24:36 GMT by Teresa Younts Word-Tech Application Support Specialist

It works that way.

Thanks much for the info.  This will be a much cleaner workflow now!

Posted Wed, 31 Jan 2018 14:43:25 GMT by Oleg Karpun Engineer

Hi 

We're experiencing similar problem with 6.12 Cloud.

I have 3 variables:

DocDate (type Date) extracted from Document Date field

UkDate (type Date)

UkDate2 (type Text)

Conversion done in 2 separate assgn data steps, and yet:

UkDate  = Format(GV_DocDate,"dd/MM/yyyy")  returns empty variable

UkDate2 = Format(Cstr(GV_DocDate),"dd/MM/yyyy") returns "dd/MM/yyyy"

I would appreciate any suggestions, thank you a lot !

Posted Wed, 31 Jan 2018 14:52:13 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

First this is not to do the arithmetic function in the SAME data assignment as you use to set the Gobal Variable.
Add another data assignment step AFTER assigning the variables. The reason is that there is no order to the assignment of the variables, and your arithmentic function is executing BEFORE the variable is assigned.
Secondly, do not convert the date with Cstr. Just use: Format(GV_DocDate),"dd/MM/yyyy")

Phil Robson
Senior Director Support Americas

 

Posted Wed, 31 Jan 2018 14:57:47 GMT by Oleg Karpun Engineer

Hi

 

Thank you for reply.

I do conversion in separate step. Does type of variable matters ? I can try to do Format(GV_DocDate),"dd/MM/yyyy") conversion with UKDate, which has Date type.

Thanks

Posted Wed, 31 Jan 2018 15:00:56 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

Your target date variable should be a string type. UKDate = String type.
UKDate = Format(GV_DocDate,"dd/MM/yyyy")

 

Phil Robson
Senior Director Support Americas

You must be signed in to post in this forum.