Skip to main content
Question

conditional attribute setter and valuemapper unwanted evaluations?


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
Hi all, a good comming year of course.

 

 

I have a question concerning conditional attributing.

 

In this case it concerns the attributesetter.

 

 

I have a dem raster to wich i added a pallete.

 

I do a conditional setting to change the colors (kind of a colorrange) adn create a new colormap.

 

test

 

if _matched_parts{0} between 0,10

 

outputvalue @Value(_bandnr{0}) 73,255,255

 

elseif etc.etc.

 

This results in a error.

 

 

If i do this same in an attributevaluemapper i get the same error.

 

 

When i do the test in a testfilter and connect a attributecreator with the same tests and outputs it works. ( i do have to remove the evaluation in the attributesetter, else it will try to evaluate "@Value(_bandnr{0}) 73,255,255" wich is a simple concatenation.)

 

This is not desirable because i get a lot of transformers.

 

 

Am i correct to assume that the valuemapper and conditionalsetter try to evaluate "@Value(_bandnr{0}) 73,255,255"?

 

How do i prevent this?

 

 

Oh, and before you go all wild Takashi, i already have made a tcl script to do this ( only one tcl caller needed now)..tho i hav'nt made a phyton version... ;)

 

But i wanted to try and stick to an all fme transformer solution (at my office i am the only making tcl and phtyon scripts)

 

 

 

here is the error log

 

-----------------------------

 

AttributeSetter: Invalid Test Expression: TEST<at>Value<openparen>_matched_parts<opencurly>0<closecurly><closeparen>BETWEEN0<comma>10.

AttributeSetter: Failed to evaluate input expression: FME_CONDITIONAL:DEFAULT_VALUE'@Value(_bandnr{0})255,14,14'BOOL_OP;OR;COMPOSITE_TEST;<Unused>;(_matched_parts{0})BETWEEN0,10'@Value(_bandnr{0})73,255,255'BOOL_OP;OR;COMPOSITE_TEST;<Unused>;(_matched_parts{0})BETWEEN10,25'@Value(_bandnr{0})199,255,119'BOOL_OP;OR;COMPOSITE_TEST;<Unused>;(_matched_parts{0})BETWEEN25,50'@Value(_bandnr{0})239,218,60'BOOL_OP;OR;COMPOSITE_TEST;<Unused>;(_matched_parts{0})BETWEEN50,75'@Value(_bandnr{0})255,57,255'BOOL_OP;OR;COMPOSITE_TEST;<Unused>;(_matched_parts{0})BETWEEN75,100'@Value(_bandnr{0})72,66,255'FME_NUM_CONDITIONS6___

Storing feature(s) to FME feature store file `H:\\Documents\\My FME Workspaces/bewoningsdichtheid_log.ffs'

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Feature Type: `AttributeSetter_OUTPUT'

Attribute(encoded: utf-8): `_bandnr{0}' has value `0 '

Attribute(string) : `_element_count' has value `17'

Attribute(32 bit integer): `_element_index' has value `1'

Attribute(encoded: utf-8): `_list' has value `0 0,0,0'

Attribute(encoded: utf-8): `_matched_characters' has value `0 0,0,0'

Attribute(encoded: utf-8): `_matched_parts{0}' has value `0'

Attribute(string) : `_palette' has value `RGB24

0 0,0,0

1 41,41,41

2 26,26,26

3 43,43,43

4 63,63,63

5 79,79,79

6 96,96,96

7 75,75,75

8 94,94,94

9 91,91,91

10 164,164,164

11 255,255,255

12 209,209,209

13 161,161,161

14 200,200,200

'

Attribute(string) : `fme_basename' has value `SurfaceModeller'

Attribute(string) : `fme_geometry' has value `fme_aggregate'

Attribute(string) : `fme_type' has value `fme_raster'

Coordinate System: `_Netherlands-RDNew-2008_0'

Geometry Type: IFMERaster

Number of Columns : 4

Number of Rows : 4

Cell Origin : 0.5,0.5

Cell Spacing : 100,100

Origin : 93359.970232381,463951.217756797

Extents : (93359.970232381,463551.217756797),(93759.970232381,463951.217756797)

Rotation : 0

Number of Bands : 1

Band Name : Band 0 : Surface Model Raster Band

Interpretation Type : Band 0 : UINT16

Nodata Value : Band 0 : N/A

Selected : Band 0 : TRUE

Number of Palettes : Band 0 : 1

Palette Name : Band 0 : Palette 0 :

Interpretation Type : Band 0 : Palette 0 : RGB24

Selected : Band 0 : Palette 0 : TRUE

Number of Entries : Band 0 : Palette 0 : 15

Palette Keys -> Values : Band 0 : Palette 0 : 0 -> 0,0,0

Palette Keys -> Values : Band 0 : Palette 0 : 1 -> 41,41,41

Palette Keys -> Values : Band 0 : Palette 0 : 2 -> 26,26,26

Palette Keys -> Values : Band 0 : Palette 0 : 3 -> 43,43,43

Palette Keys -> Values : Band 0 : Palette 0 : 4 -> 63,63,63

Palette Keys -> Values : Band 0 : Palette 0 : 5 -> 79,79,79

Palette Keys -> Values : Band 0 : Palette 0 : 6 -> 96,96,96

Palette Keys -> Values : Band 0 : Palette 0 : 7 -> 75,75,75

Palette Keys -> Values : Band 0 : Palette 0 : 8 -> 94,94,94

Palette Keys -> Values : Band 0 : Palette 0 : 9 -> 91,91,91

Palette Keys -> Values : Band 0 : Palette 0 : 10 -> 164,164,164

Palette Keys -> Values : Band 0 : Palette 0 : 11 -> 255,255,255

Palette Keys -> Values : Band 0 : Palette 0 : 12 -> 209,209,209

Palette Keys -> Values : Band 0 : Palette 0 : 13 -> 161,161,161

Palette Keys -> Values : Band 0 : Palette 0 : 14 -> 200,200,200

===========================================================================

AttributeSetter: @Tcl2 -- failed to evaluate expression `AttributeSetter_eecd1ff7_96e1_4fe9_b07f_571bdec4c22d3_doSetAttr' -- A fatal error has occurred. Check the logfile above for details

@%0 -- failed to evaluate expression `%1' -- %2

A fatal error has occurred. Check the logfile above for details

A fatal error has occurred. Check the logfile above for details

 

The tests and the attriubtes to set do work when using a testfilter and a bunch of attributecreators as i said earlier.

4 replies

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 9, 2014
Hi Gio, a Happy New Year!   It seems that you are trying to do conditional value settings in FME 2012 or earlier. If so, I don't think it's possible without the TesteFilter and several AttributeCreators or scripting... Which version FME are you using?

 

 

Takashi

gio
Contributor
Forum|alt.badge.img+15
  • Author
  • Contributor
  • January 9, 2014
im using fme 2013 sp2

 

i was doing conditionals in the attributesetter. This give the error message i posted.

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 10, 2014
I tested in FME 2013 SP2 build 13499, this setting worked with no error. Is there any difference from yours?

 


gio
Contributor
Forum|alt.badge.img+15
  • Author
  • Contributor
  • January 10, 2014
Hi Takashi,

 

 

Nope, its the same as u post. Also i use same build.

 

 

Then i must assume a invalid testclause must be the problem, that would be an input issue.

 

Though i m sure i filtered out the first and last line of the palette (RGB48 and NULL) and only integers end up in (_matched_parts{0}).

 

A faulty assumption i suppose, I will see if i can find it.

 

 

Thanks for the verification.

 

 

I will let you know what was buggin the test as soon as i find it.

 

 

 

Greetings,

 

 

Gio

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