Question

post to fmepedia


Badge +6
Hi

 

Can you use a Case Changer on an unexploded list.

 

So all values within that list are put to the same case so it makes it easier for ListSearcher queries to work (or can I do something in the ListSearcher to make this happen)

 

 

DL

5 replies

Userlevel 2
Badge +17
Hi,

 

 

The ListSearcher seems not to have case insensitive option.

 

A workaround I can think of is:

 

1) Concatenate the list using the ListConcatenator.

 

2) Change case of the concatenated string using the StringCaseChanger.

 

3) Transform the concatenated string into a list using the AttributeSplitter.

 

4) Then, apply the ListSearcher.

 

 

Alternatively, a Python or Tcl script could be an effective solution for searching a matched list element in the condition of case insensitive.

 

 

Takashi
Badge +3
ListSearcher regular expression is strangely limited. It does not accept a lot of switches. One of those is the nocase switch. Alas.

 

 

The switches do work if u use listsearcher tcl in a attributecreator or expressionevaluator

 

[regexp -nocase -all -inline {@Value(expression ()) } @Value(Attribute)]  or something like that.
Userlevel 2
Badge +17
For example, the TclCaller with this script extracts first matched element and index in the list with "_pattern" in case-insensitive manner.

 

-----

 

proc searchList {} {

 

   set values {}

 

   for {set i 0} {[FME_AttributeExists "_list{$i}"]} {incr i} {

 

       lappend values [FME_GetAttribute "_list{$i}"]

 

   }

 

   set index [lsearch -exact -nocase $values [FME_GetAttribute "_pattern"]]

 

   if {0 <= $index} {

 

       FME_SetAttribute "_first_matched_element" [lindex $values $index]

 

   }

 

   return $index

 

}

 

-----
Badge +3
mailto insertion...how do i prevent this postingsystem doing that?
Userlevel 2
Badge +17
Gio, try use "Add a code smple". I've never used it...

 

 

Reply