Hi @taojunabc, why not use the StringCaseChanger, or am I missing something?
Hi @itay,
Sorry,
I did not describe the problem clearly, My ultimate goal is to handle the list attributes, such as attribute{}.name. But StringCaseChanger can not be applied to the list attributes.
Please refer to the link below?
Lowercase PostGIS table namesIn FME hub, there is a custom transformer called ListStringReplacer, It
is possible to use regular expressions, but I tried it and found that
it has the same behavior as StringReplacer, in order to simplify the
problem, I mentioned only StringReplacer.
Hi @taojunabc, I don't know if it's intentional that FME String Functions do not work for the resulting string from the StringReplacer. I remember that there was the same question before, but was not able to find out that.
Scripting may be a quick workaround in your case.
PythonCaller Script Example:
def toLower(feature):
    names = feature.getAttribute('attribute{}.name')
    if names:
        for i, s in enumerate(names):
            feature.setAttribute('attribute{%d}.name' % i, s.lower())
TclCaller Script Example:
proc toLower {} {
    for {set i 0} {1} {incr i} {
        set attr "attribute{$i}.name"
        if {!ÂFME_AttributeExists $attr]} {
            break
        }
        FME_SetAttribute $attr string tolower !FME_GetAttribute $attr]]
    }
}
Hi @itay,
Sorry,
I did not describe the problem clearly, My ultimate goal is to handle the list attributes, such as attribute{}.name. But StringCaseChanger can not be applied to the list attributes.
Please refer to the link below?
Lowercase PostGIS table namesIn FME hub, there is a custom transformer called ListStringReplacer, It
is possible to use regular expressions, but I tried it and found that
it has the same behavior as StringReplacer, in order to simplify the
problem, I mentioned only StringReplacer.
I see, this makes sense, beside the elegant solution by @takashi the only other way I can think of is by exploding the list and applying the case change.
Â
Hi @taojunabc, I don't know if it's intentional that FME String Functions do not work for the resulting string from the StringReplacer. I remember that there was the same question before, but was not able to find out that.
Scripting may be a quick workaround in your case.
PythonCaller Script Example:
def toLower(feature):
    names = feature.getAttribute('attribute{}.name')
    if names:
        for i, s in enumerate(names):
            feature.setAttribute('attribute{%d}.name' % i, s.lower())
TclCaller Script Example:
proc toLower {} {
    for {set i 0} {1} {incr i} {
        set attr "attribute{$i}.name"
        if {!ÂFME_AttributeExists $attr]} {
            break
        }
        FME_SetAttribute $attr string tolower !FME_GetAttribute $attr]]
    }
}
Thank you for providing sample code,  PythonCaller or TclCaller is a relatively simple solution.Â
Â
Â
I see, this makes sense, beside the elegant solution by @takashi the only other way I can think of is by exploding the list and applying the case change.
Â
Hi @itay,Thanks.
Â
I did not think of other solution, the solution by @takashi is very simple, I decided to use his solution.
Â