Solved

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


Badge

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

icon

Best answer by takashi 11 January 2016, 16:10

View original

10 replies

Userlevel 4
Badge +13

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.

Userlevel 2
Badge +12

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?

Badge

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

Badge

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

Userlevel 4

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?

Userlevel 4

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

Badge

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.

Userlevel 2
Badge +17

Did you set proper data type to "_area"?

Badge

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

Userlevel 2
Badge +12

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.

Reply