Converting a string to date variable in NWC workflow


Userlevel 4
Badge +12

I have a component workflow that is receiving dates as a string variable.

The dates are supplied from another web service that is only exporting text strings.

The dates are formatted 'yyyy-mm-dd'

I want to convert this to a date variable in NWC.

I have a variable txtFromDate (text) and dateFromDate (datetime).

I tried set a variable action but the variable types are not supported.

 

Any ideas on this?


19 replies

Userlevel 2
Badge +7

Hello @Gavin-Adams , 


 


at the moment, this is not possible in standard -


Please have a look at our roadmap, we will implement this feature this quarter.


 


https://community.nintex.com/t5/Roadmap/Nintex-Product-Roadmaps/ba-p/94755


 


Userlevel 3
Badge +9
Any update on this? As per today (27-May-2022) I cannot seem to find anything that supports this nor see it anywhere anymore in the roadmap.
Badge +3

I'm needing to do the same.  Any update on the implementation of this?


 


 

Userlevel 2
Badge +7

Hi everyone,


 


thanks for the patience, we will check with the product managers and get back to you soon.


 


regards


 


Sven

Userlevel 3
Badge +9

OK @Gavin-Adams and @anissa_divincen .


Here is the most ugly workaround you've probably ever seen. More just for the fun of it. I just couldn't cope with 'no' for an answer 😉


A component workflow that transfers any format of a date into a date var. Hope it works for you.


Here is an export key for the component workflow (valid until June 13): QWjRqAHSScRdnLhWZcVd4GLgWzERnDM5JuWpy51ghvzi5LmfG


If you need another export key, drop a reply and I'll provide it.


 


The format input par is by default (if empty) yyyymmdd


But you might also specify anything else that has yyyy, mm and dd strings in it. Such as dd-mm-yyyy or mm/dd/yyyy.


 


No warranty on this little exercise. Check the workflow yourself before using it for real. I actually do not recommend using it, Nintex should come with a real solution.


But really... it is 2022 and we're talking 'global leaders' in software... That we still have to do this - even for the fun of it - is a bit of a shame, isn't it? 

Badge +3

Thank you so much, that workflow is exactly what I needed.  At least until they build this into NWC.  Amazed they haven't already. It works perfectly!

Hi,


the export key doen't work any more. Could you please send a new one, because i have to solve the same problem.


Thanks.

Userlevel 3
Badge +9

Hi @EhlertS ,


Here is a new export key: QWuqEh5xFKWxmRhVSuFTNPGdEQNFmRQoGAy9ugfkrUhCcUZEz

It's a roundabout way - but it works - many thanks 🙂
Badge +1

Hi, 


 


Can you publish a new export key? Thank you.

Badge +1

The NWC toolkit has an action (Convert String to Proper) 


that will do this conversion.


 


https://community.nintex.com/t5/Blog/NWC-Toolkit/ba-p/213241

Userlevel 3
Badge +9

@alexviera that is good to hear. I'll try the toolkit.


Just in case,  here is the export key: Qsgj5mxy3P9fjXQUiPpcFsNhM25U3gF4nDu3ezuMSANQcZBb8

Badge +1

Sorry, it was expired 😉 One more time please.

Userlevel 3
Badge +9
jtjcojq3X7U2d872ot7Upn4MSciDuvHR3x1muXWpZyjgrzxbk at your service.
Userlevel 3
Badge +9

As @alexviera already noted: please use the NWC Toolkit instead. Easier, better, quicker.


Link to the NWC Toolkit page.

Userlevel 3
Badge +9

Just tested the NWC Toolkit: all works fine... except... for the date formatter.! Also the NWC Toolkit DateFormatter is an action to convert a date into a string but not the other way around: a string into a date. And that's what we're looking for.


So, I guess you're all back to my (clumsy but workable) solution for now. See also comments on : https://community.nintex.com/t5/Blog/NWC-Toolkit/ba-p/213241


I'll post an update soon with a more simple DIY step by step.


 

Userlevel 3
Badge +9

Here is a special post on how to DIY convert a date in text to a date variable.

Badge +1

Ok, maybe I'm missing something. If you take a string date "7/10/2022" and want to convert it to a datetime you call Convert String to Proper, isn't that what you are trying to do?


 


 

Userlevel 3
Badge +9

Well done @alexviera ! Kudo well deserved.


The documentation of the toolkit is so brief that I overlooked it. Probably also not realizing the proper meaning of  the word "to Proper". 😉


Took me a while to figure out that the result variable has to be defined as a date variable within the NWC Toolkit section (and not as a workflow variable):


Secondly, the input string has to be in the right format: in my case mm/dd/yyyy. Probably my regional settings. Otherwise it results in this error:



But if that is not an issue: Yep, it works.

Reply