Skip to main content
Question

Manipulate the Attribute_name with value of a parameter

  • November 25, 2020
  • 3 replies
  • 20 views

perry
Forum|alt.badge.img+2

Hello,

Is there a method to combine a STANDARD TEXT with the VALUE of a PARAMETER and use thia as the NAME of an ATTRIBUTE?

The value of the parameter varies with the loop.

Ie:

TEXT : DAYS_

PARAMETER-VALUE : 2017, (next time) 2018, , (next time) 2019

 

So I want to name the new attribute:

- the 1st time: DAYS_2017

- the second time: DAYS_2018

- the third time: DAYS_2019

- ...

etc.

 

The value of the attribute is calculated by DATE_END-DATE_START in days.

So the output looks like this:

NumberFile DD_START DD_END DAYS_2017 DAYS_2018 DAYS_2019

5124 20180101 20200131 0 365 31

 

Please response if it is not possible to make an ATTRIBUTE_NAME while looping with parameters.

(I also tried the AttributeDereferencer and attribute exposer and other transformers without succes.)

Thank you,

Perry

3 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • November 25, 2020

In an attributeCreator in the New Attribute you can put Days_$(param). It will be red in the input box, but the translation should run without issue. Note that since this is a dynamic attribute it won't be visible on the canvas for later transformers to use, but it will be on the feature.


Forum|alt.badge.img+2
  • November 25, 2020

@perry​ If you are trying to transpose data try the AttributeTransposer custom transformer from the FME HUB and look at the article: Transpose a Table Using FME for ideas.

If you have name/value pairs, you can use the same approach described by @jdh​  with attributes using the attribute creator. You can build up the name of the attribute in the AttributeCreator Text Editor.

NameValuePairsParameters are constant for the life of a workspace run, so you might not be able to get a list of dates that you show above.


perry
Forum|alt.badge.img+2
  • Author
  • November 25, 2020

Hi,

Indeed I was confused about the RED in the input-box and that the output was not visible in the canvas as mentioned by jdh.

I have tried a little test with

  • Calculate the days (datetimecalculator) with result attribute DAYS
  • then a attribute_creator and new_value <DAYS_@Evaluate($(JAAR_OUD)+@Value(T_TELLER)) > and value <DAYS>

My firts impression is that it seems to work good:

DAYS_2017 DAYS_2018 DAYS_2019

364 364

Tomorrow I will try to implement this in a loop.

(@Mark: I will surely investigate your tip Attribute Transposer.)

For now: thank you all for your support. 😊

 

 


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