Skip to main content
Solved

Change attribute data type in an InlineQuerier at an intermediate step in an FME workspace


Forum|alt.badge.img

Can I change the data type of the area calculator attribute ? it is taken as string by default and I am facing trouble when I do a max function on the column that has all the area values

Best answer by takashi

Did you set proper data type to "_area"?

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

10 replies

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 10, 2016

Where are you doing a max function? FME's functions will all automatically turn strings into numbers if need be. Can you advise what the error message is and where it occurs? In general, the goal with FME's design was that you needn't worry about data types throughout the transformation process (though we are moving to allow more control of that as time goes on), but that instead we'd automatically look after things for users and convert when need be.


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 11, 2016

Can this be a problem with decimal "," (comma). I have seen this habit in the Netherlands before. What happens if you use a StringReplacer, replacing the comma with a point before getting the maximum value?


Forum|alt.badge.img
  • Author
  • January 11, 2016
fmelizard wrote:

Where are you doing a max function? FME's functions will all automatically turn strings into numbers if need be. Can you advise what the error message is and where it occurs? In general, the goal with FME's design was that you needn't worry about data types throughout the transformation process (though we are moving to allow more control of that as time goes on), but that instead we'd automatically look after things for users and convert when need be.

Thanks for your reply. I do the max function on the '-area' field after having calculated the area of a polygon layer using the area calculator transformer.

There are no error messages. The problem here is that, since the _area field is given a char(200) by default, the max function treats the column values as string, thereby not producing the desired max number...for example 52345 is chosen as the max value among 52345, 1590567, 3170438


Forum|alt.badge.img
  • Author
  • January 11, 2016
erik_jan wrote:

Can this be a problem with decimal "," (comma). I have seen this habit in the Netherlands before. What happens if you use a StringReplacer, replacing the comma with a point before getting the maximum value?

I already have the area stat in decimal. What I am trying to overcome is the string data type of the field that contains the area. When I output data after doing the area calculation, the area field is assigned a char 200 by default. I need fme to use a decimal type instead


david_r
Evangelist
  • January 11, 2016

I have some webhooks that I am migrating to a new FME Server, these were previously working on another FME Server instance. But now that I have migrated to a new FME Server these webhooks are returning HTTP 500. I have looked at the logs and in the catalina log there is this message

 

Invalid character found in method name [lv[endof...]. HTTP method names must be tokens

 

The request headers coming out of python look like this

{'User-Agent''python-requests/2.24.0''Accept-Encoding''gzip, deflate''Accept''*/*''Connection''keep-alive''Authorization''fmetoken token=token''Content-Length''0'}

 

In the datastreaming log in FME Server I found this

Thu-23-Jul-2020 10:21:35.970 AM   FATAL    http-nio-80-exec-6   412007 : Service failed: java.nio.file.AccessDeniedException: C:\ProgramData\Safe Software\FME Server\resources\system\temp\requestdata\9058908488982796417 

 

When I paste the webhook into my browser with the token it works fine but when I use the same URL with the python request library I get HTTP 500.

Has anyone had a similar issue?


david_r
Evangelist
  • January 11, 2016

What exactly do you mean by "when I do a max function"? Could you give an example?


Forum|alt.badge.img
  • Author
  • January 11, 2016
david_r wrote:

What exactly do you mean by "when I do a max function"? Could you give an example?

Sorry for the ambiguity. After the data goes through areacalculator transformer, I use an inlinequerier with the following query to find the largest polygon among those that have the same 'long_side'. The result of the query is lexicographical

SELECT * FROM area where _area in (select max(_area) from area group by long_side)

This is the input file

This is the output I get

The desired max value for the 2 records that have long_side = 0.23986593... is 134292143 but as we see in the output it is 50523846.


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • Best Answer
  • January 11, 2016

Did you set proper data type to "_area"?


Forum|alt.badge.img
  • Author
  • January 11, 2016
takashi wrote:

Did you set proper data type to "_area"?

Thanks. I didn't know the existence of the 'ellipsis' button there...The thing is that it shows up only when you click that cell ! Somehow narrowly missed it :-(

In fact, the SQL Query window opens up in the same manner in the inlinequerier ! But thanks ! now I know something new


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 11, 2016
david_r wrote:

I suspect what @erik_jan is getting at, is that you should verify that you use the correct decimal separator. Some locales use a point, some use a comma. If you use a different decimal separator than the current locale, your numbers will be treated as strings.

Yes, David is right. That is what I was trying to explain. Local settings can cause a different decimal separator (comma instead of point) and therefor your numeric value can be treated as string.


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