Skip to main content
Question

FME 2018 FMW reader Parameter value SQL_STATEMENT format


mferwerda1111
Participant
Forum|alt.badge.img+2

In FME 2018 when reading out the SQL_STATEMENT from the Transformer Parameters reader, the SQL comes out formatted roughout like this example:

SELECT<space><lf>SITE_ID_FS<comma><lf>LIFEFORM<comma><lf>PLANT_CODE<comma>

 

<space><space><space><space><space><space><space>from<space>my_table<lf><space>

 

where <space> LIFEFORM <space>= <space><apos>TR<apos>

 

Is there an easy way to decode this back to a simple text that will run again in a SQL window ?

It looks like FME 2019 handles this better, but I am limited to 2018 for now.

2 replies

david_r
Celebrity
  • June 19, 2019

Try the following in a PythonCaller:

import fmeobjects

def decode_fme_encoded_string(feature):
    text = feature.getAttribute('sql')
    if text:
        decoded = fmeobjects.FMESession().decodeFromFMEParsableText(text)
        feature.setAttribute('sql', decoded)

Assuming that the attribute name is 'sql'.


mferwerda1111
Participant
Forum|alt.badge.img+2
  • Author
  • Participant
  • June 19, 2019

Thanks,much appreciated


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