Skip to main content
Question

FME 2018 FMW reader Parameter value SQL_STATEMENT format

  • June 18, 2019
  • 2 replies
  • 21 views

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.

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.

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