Skip to main content
Question

Date

  • June 19, 2017
  • 8 replies
  • 34 views

nath
Contributor
Forum|alt.badge.img+7

I have a field type string contains a date like "20170104" and i have to change it to "2017/01/04".

I have tried de dateformatter (then the model crashes), the stringsearcher (i don't find the right expression) or the attributesplitter but i have no delitimer .

Has somebody a quick way to do this?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

8 replies

takashi
Celebrity
  • June 19, 2017

Hi @nath, the DateFormatter with these parameters should work.

  • Source Date Format: Unknown - Automatic Detection (or %Y%m%d)
  • Destination Date Format: %Y/%m/%d

Would your Workbnch still crash with the parameters above?


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 19, 2017

@nath

The dateformatter works fine for your requirement.

source: %Y%m%d

dest format:

%Y/%m/%d


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 19, 2017

maybe you are including the quotes? Don't.

Does it crash on the dateformatter at all? Or maybe later in process?


nath
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • June 19, 2017

I got the crash when i tried using the DateFormatter. I thought that it had something to do because i had merged the tables from shp and csv files together. It worked fine on the shp but not with the csv.


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • June 19, 2017

It's not the approach I'd use here, but if you want to split a string without a delimiter you can use a format string to split an attribute, e.g.

4s2s2s

would split 20170104 into

2017

01

04


takashi
Celebrity
  • June 19, 2017

I got the crash when i tried using the DateFormatter. I thought that it had something to do because i had merged the tables from shp and csv files together. It worked fine on the shp but not with the csv.

Theoretically the DateFormatter should work fine regardless of the source data format. If the workspace always crashes in your specific condition, I would recommend you to contact safe to clarify the cause.

 

In the interim, the StringReplacer would also be a workaround.

 

  • Mode: Replace Regular Expression
  • Text To Replace: ^(....)(..)(..)$
  • Replacement Text: \\1/\\2/\\3

ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • June 19, 2017

Hi @nath, the DateFormatter with these parameters should work.

  • Source Date Format: Unknown - Automatic Detection (or %Y%m%d)
  • Destination Date Format: %Y/%m/%d

Would your Workbnch still crash with the parameters above?

If running 2016 depending on the build there is a bug that means automatic detection does not work

 

 


nath
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • June 19, 2017

Thanks everyone. If I do it with a small amount of data, it works well, so I think it has something to do with an earlier problem that always crashes my workspace. I've contacted Safe and they are looking for a solution.