Good morning,
I've encountered a similar problem as described below: I want to
add double quotes to the beginning and end of text strings. In the
Concatenator transformer, I type " as a constant and add it twice to
the "Concatenated Items" window (both before and after the attribute
(called FeatureName) holding my text string).
The "Concatenated Items" window now looks like this:
"""
FEATURENAME
"""
This seems to make sense. In this window, the single set of double
quotes I actually
type in is itself put in double quotes, so there are three sets of
double quotes.
I would think that the Concatenator's result written to the output
attribute
would then be "WILLIAMS ROAD" or "MAPLE COURT" (depending on
what the actual FEATURENAME is). However, the output is actually
"""WILLIAMS ROAD""", which I do not understand. Does anyone know how I
could just create single sets of double quotes using Workbench? I can
see that people have posted relevant information on this topic, but
TCL is used, and I know almost nothing about using TCL (apart from
pasting a line into the TCLCaller transformer).
I even tried to use the Substring Extractor transformer to remove the
superfluous double quotes, but I'm not getting the results I want.
Regards,
JD
--- In [email protected], Graeme Hiebert <[EMAIL PROTECTED]> wrote:
>
> I feel your pain. The FME mapping file parser hasn't scaled as well
> over the years as other parts of FME. Workbench has eased the pain for
> most users, but there are still some of us fogies left who have to deal
> with this every day. :^)
>
> You were actually very close. The trick is that the FME parser gets a
> crack at the TCL program code before it is passed off to the TCL
> interpreter. Working backwards, what you want in TCL is
>
> regsub ... {"} FME_Attributes(INPUTVAL)
>
> To insert a quote into a quoted string in FME, you just have to precede
> it by a backslash. Thus, if your FME string read
>
> @TCL("regsub ... {\"} FME_Attributes(INPUTVAL)")
>
> FME would take everything between the outer quotes, replacing the \"
> with a simple ", to the TCL interpreter, and you would get what you
> want.
>
> Thus, the whole @TCL call should look like:
>
> @TCL("regsub $(casemac) -all {doublequote}
$FME_Attributes(INPUTVAL)
> {\"} FME_Attributes(INPUTVAL)") @Log("Output")
>
> (That's all on one line, of course.)
>
> -g
> --
> On Saturday, August 30, 2003, at 07:56 PM, whitehousegis wrote:
>
> > FME'ers
> >
> > Reviewing several ways to produce double quotes I have experienced
> > difficulty producing double quotes. In the course of writing a look
> > up table from a mapping file to be used by another mapping file we
> > have run into difficulties writing double quotes.
> >
> > Below is a sample of the feature created and an effort to use TCL to
> > substitute doublequote with "".
> >
> > Any help would be greatly appreciated as I am stumped after looking
> > at TCL, the concatenate function and the workbench string replacer.
> > The function below works with other strings, just not "".
> >
> >
> > FACTORY_DEF * CreationFactory \
> > FACTORY_NAME "Create Catch All Lookup Feature" \
> > CREATE_AT_END \
> > OUTPUT FEATURE_TYPE atend @SupplyAttributes
> > (INPUTVAL,"doublequote no")
> >
> >
> > MACRO casemac
> >
> > INCLUDE [ if { {no} == {no} } { puts {MACRO casemac -nocase}} ]
> >
> > FACTORY_DEF *
> > TeeFactory \
> > FACTORY_NAME
> > STRINGREPLACER \
> > INPUT FEATURE_TYPE
> > atend \
> > OUTPUT FEATURE_TYPE DWGSTDLYRLOOKUP \
> > @TCL("regsub $(casemac) -all {doublequote} $FME_Attributes
> > (INPUTVAL) {""} FME_Attributes(INPUTVAL)")
>
For insights into what's up at Safe Software and what's on the development
horizon, visit Safe's blog at spatial-etl.blogspot.com.
Safe Software has also made slides available that outline enhancements planned
for FME 2007. The slides are from the "Road Ahead" presentation given on Day 2
of the FME Worldwide Users Conference. To view these slides, visit
www.safe.com/2006uc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/fme/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/fme/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/