Skip to main content
Solved

How to stop AttributePivoter converting my numeric data into varchar?

  • March 31, 2023
  • 6 replies
  • 70 views

Hi there,

 

I'm running into an issue where an attribute that was initially numeric ('counts') is being converted to a character type after I sum 'counts' for each 'tree_type' per 'area_unit' using AttributePivoter (example left to right in image below).

 

Tree CountsNote: These attributes/data are just an example.

 

This is a problem as I'm trying to write the results as a shapefile, which won't work properly for analysis in ArcGIS Pro as it recognises these fields as text rather than integer.

 

Here are more details about my process for summing counts of tree types by area unit.

 

Input = CSV and 'counts' is read in as UInt32.

1.) I used an AttributeExploder with exploding type set to List, Keep Attributes = Yes, and Keep Geometry = No (Geometry is added later).

2.) AttributePivoter, Group Rows By: = 'area_unit', Group Columns By: = 'tree_type', Attributes To Analyze: = 'counts', Pivot Summary Statistic Types: = Sum, Row Group Summary Line Descriptor: = Total, Include Grand Total Columns: = Yes,

3.) AttributeExposer where attributes to expose is each tree type.

 

Not too sure why the new attributes created based off the counts are coming out as varchar when the 'counts' column goes into the transformer as numeric. Is there anything I'm doing wrong which is causing this? Or, is there a way to convert these attributes back into a numeric type in the workbench?

 

Thanks.

Best answer by caracadrian

FME doesn't really care about data types.

They are only important when writing. So, configure your writer accordingly.

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.

6 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3422 replies
  • March 31, 2023

If the input is as per your image on the left, what is the AttributeExploder for?

I don't generally use AttributePivoter to pivot data, but counts remain numeric for me.


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • 571 replies
  • Best Answer
  • March 31, 2023

FME doesn't really care about data types.

They are only important when writing. So, configure your writer accordingly.


Forum|alt.badge.img+2
  • 1891 replies
  • March 31, 2023

@scottt​ or... pass your data through the SchemaScanner and use a dynamic writer on your Shape File. A bit more on SchemaScanner here. And the video (starts around minute 3)


  • Author
  • 2 replies
  • April 2, 2023

FME doesn't really care about data types.

They are only important when writing. So, configure your writer accordingly.

Hi,

 

I tried manually setting the writer to numeric data types but it doesn't work


  • Author
  • 2 replies
  • April 2, 2023

FME doesn't really care about data types.

They are only important when writing. So, configure your writer accordingly.

After doing more testing I believe the issue is an ArcGIS Pro issue rather than an FME issue in terms of reading that data properly. Thanks for the help


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • 571 replies
  • April 3, 2023

After doing more testing I believe the issue is an ArcGIS Pro issue rather than an FME issue in terms of reading that data properly. Thanks for the help

ArcGIS Pro has a very unholy way of handling Excel files. Both when writing and reading.

Try exporting a dataset with a lot of attributes/columns (25+) from Arc Pro and see header stacking in all it's splendor 😁

Glad you found the problem.