Skip to main content
Question

How to reference and extract date and time from CSV cell to populate new data columns


jhu_20
Contributor
Forum|alt.badge.img+4

I am reading in a CSV file. I need to reference the first cell (Column MA and row 1) and extract the date and time from this cell, and use these two values to populate two new columns - Date and Time, and add these two new columns to my output along with existing columns such as MA, 1, 2, 3 from current CSV files. I like to get hep on how to reference and extra the cell value, and then add the two columns through AttributeManager or AttributeCreator. Thanks in advance for your help.

6 replies

danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • April 18, 2022

Hi @jhu_20​ 

 

Please, could you share your data?

 

Thanks in Advance,

Danilo


jhu_20
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • April 18, 2022

Danilo,

Thanks for your message. Please see attached sample data which I need to extract date and time from the CSV row1 and column1 cell, and add as two new columns with date and time values. Please help.


jhu_20
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • April 18, 2022

Sample file


danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • April 18, 2022
jhu_20 wrote:

Sample file

Thanks!


danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • April 18, 2022

Hi @jhu_20​ 

 

For your case - I used the transformer StringSearcher:

 

StringSearcher 

In the both transformers, I used regular expression to find: Date and Time. As you can see the Workspace attached, it was created list of attributes:

 

Result 

Attached the Workspace.

 

Thanks in Advance,

Danilo

 

 


jhu_20
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • April 18, 2022

Danilo,

Thanks for your suggestion. Since this is always in the cell of first row and first column for all CSV file (daily storm forecast data), is any way I can just reference the cell somehow and extract the date and time value ? In the mean time, I will look into your suggestion in more detail. Thanks.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings