Skip to main content
Question

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

  • Apr 18, 2022 1:15 PM UTC
  • 6 replies
  • 184 views

jhu_20
Contributor
Forum|alt.badge.img+12

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
Celebrity
Forum|alt.badge.img+58
  • Celebrity
  • Apr 18, 2022 3:26 PM UTC

Hi @jhu_20​ 

 

Please, could you share your data?

 

Thanks in Advance,

Danilo


jhu_20
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • Apr 18, 2022 4:31 PM UTC

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+12
  • Author
  • Contributor
  • Apr 18, 2022 4:32 PM UTC

Sample file


danilo_fme
Celebrity
Forum|alt.badge.img+58
  • Celebrity
  • Apr 18, 2022 4:48 PM UTC

Sample file

Thanks!


danilo_fme
Celebrity
Forum|alt.badge.img+58
  • Celebrity
  • Apr 18, 2022 4:52 PM UTC

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+12
  • Author
  • Contributor
  • Apr 18, 2022 5:31 PM UTC

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.