Question

change values in attribute that has has the same values in another attribute to new value


Badge +13

 

 

ID

 

DIESEL

 

last

 

1

 

2

 

2

 

23

 

5

 

 

4

 

5

 

 

5

 

3

 

1

 

1

 

1

 

6

 

5

 

10

 

3

 

2

 

1

 

 

 

 

i want to check for every id ,if it has a value in last attribute or not

 

if it has so

it should check also if this id is repeated in same attribute ID or not

if yes so it will check which value in last attribute that it has

bcs both of them has the same id so i want to take the two values that it has found as example above 1 and 2

and search in Diesel attribute which contains 1 and 2 and change to new value say 15 but it is important the new value not include in Diesel attribute any number does not matter but new value not include in diesel attribute

 

but if the id has only one value in last attribute and no common id in id attribute so

i want to take this value and change all value that has the same number in Diesel attribute to new value not included in diesel attribute .

 

I spent too much hours with if condition in attribute manager and attribute creator and null attribute mapper but no success .could u guide me ,how could i do that .

consider that i do not know which values in attrbute last

because it changes

FME version 2018

i tried similar for this method from another article but i do not know what i missed

@ebygomm


14 replies

Badge +16

I think what you are looking for are conditional statements. This option is available in both transformers you mention.

This allows you to set an if else statement to set your attribute value.

Hope this helps,

Itay

Badge +13

I think what you are looking for are conditional statements. This option is available in both transformers you mention.

This allows you to set an if else statement to set your attribute value.

Hope this helps,

Itay

Thanks for ur reply ,i know it should sth condition but i am confused to write it .i tried alot but no success in expected output .

if u do not mind , i want to explain briefly

i want exactly to check for every id has a value in last attribute or not

 

if it has so

it should check also if this id is repeated in same attribute ID or not

if yes so it will check which value in last attribute that it has

bcs both of them has the same id so i want to take the two values that it has found as example above 1 and 2

and search in Diesel attribute which contains 1 and 2 and change to new value say 10 but it is important the new value not include in Diesel attribute do any number does not matter but new value not include in diesel attribute

 

but if the id has only one value in last attribute and no common in id attribute so

i wwant to take this value and change in Diesel attribute to new value not included in diesel attribute .

 

I tried too much with if condition in attribute manager and null attribute mapper but no success .could u guide me ,how could i do that .

FME version 2018

Thanks

Userlevel 2
Badge +17

Is this explaining your requirement correctly?

Change the values of "DIESEL" in rows where "ID" matches one of values in "last" field - 1, 2 and 3 in the example.

A new "DIESEL" value can be any but it should not match any of the original "DIESEL" values.

In the rows of which "DIESEL" should be changed, if "ID" in two or more rows are identical , the new "DIESEL" values in those rows should also be identical.

The example table should be transformed to:

 

If I understand your requirement correctly, this workspace might help you: csv22none.fmwt (FME 2018.1.2)

Badge +13

Is this explaining your requirement correctly?

Change the values of "DIESEL" in rows where "ID" matches one of values in "last" field - 1, 2 and 3 in the example.

A new "DIESEL" value can be any but it should not match any of the original "DIESEL" values.

In the rows of which "DIESEL" should be changed, if "ID" in two or more rows are identical , the new "DIESEL" values in those rows should also be identical.

The example table should be transformed to:

 

If I understand your requirement correctly, this workspace might help you: csv22none.fmwt (FME 2018.1.2)

thanks for ur workspace.u did great job but it is almost what i need but i want to change in diesel attribute any value has 1 or 2 for same id to 110 as u did so last row instead of 111 should be 110 . and also for value 3 to search in attribute diesel and any value has value 3 ,change to new value not include in diesel row .

but thanks alot for ur effort and i will try to work around what u did but if u can help me ,it will be nice from you .Thanks alot
Userlevel 2
Badge +17

Is this explaining your requirement correctly?

Change the values of "DIESEL" in rows where "ID" matches one of values in "last" field - 1, 2 and 3 in the example.

A new "DIESEL" value can be any but it should not match any of the original "DIESEL" values.

In the rows of which "DIESEL" should be changed, if "ID" in two or more rows are identical , the new "DIESEL" values in those rows should also be identical.

The example table should be transformed to:

 

If I understand your requirement correctly, this workspace might help you: csv22none.fmwt (FME 2018.1.2)

Do you need to replace every DIESEL value that matches one of "last" values (1, 2, 3) with an identical new value (e.g. 110) regardless of ID, like this?

Badge +13

Do you need to replace every DIESEL value that matches one of "last" values (1, 2, 3) with an identical new value (e.g. 110) regardless of ID, like this?

ID DIESEL LAST

1

 

110

 

2

 

23

 

5

 

 

4

 

5

 

 

5

 

111

 

 

1

 

110

 

1

 

6

 

 

 

5

 

10

 

3

 

2

 

110

 

 

 

if id common as 1 value in id attribute so take any value in last attribute in front of the common id like 2 and 1 then change any value includes 2 and 1 in Diesel attribute for any id .only for 2 and 1 chaange to 110

 

bcs last has value still 3 and in front of id 5 so change any value has 3 in diesel attribute to new value like 111 as above.

 

if we have new values in attribute last so it work the same check if it has common id or not and take the value in front of id in last attribute and change it in attribute diesel for any values that include the same value in front of id to new value not included in the diesel attribute . and check each idThanks for helping

Userlevel 2
Badge +17

Is this explaining your requirement correctly?

Change the values of "DIESEL" in rows where "ID" matches one of values in "last" field - 1, 2 and 3 in the example.

A new "DIESEL" value can be any but it should not match any of the original "DIESEL" values.

In the rows of which "DIESEL" should be changed, if "ID" in two or more rows are identical , the new "DIESEL" values in those rows should also be identical.

The example table should be transformed to:

 

If I understand your requirement correctly, this workspace might help you: csv22none.fmwt (FME 2018.1.2)

Is this right?

  • DIESEL that is equal to one of last values (1, 2, 3) should be replaced with a new value.
  • There could be two new DIESEL values (e.g. 110 and 111). One is for the rows having ID that is equal to one of last values, another is for the rows having ID that is different from any of last values.
  • The new DIESEL values should be different from any of the original DIESEL values.
Badge +13

Is this right?

  • DIESEL that is equal to one of last values (1, 2, 3) should be replaced with a new value.
  • There could be two new DIESEL values (e.g. 110 and 111). One is for the rows having ID that is equal to one of last values, another is for the rows having ID that is different from any of last values.
  • The new DIESEL values should be different from any of the original DIESEL values.

Diesel depends on Last attribute

1,2,3 should replaced to new values

there could be two new diesel values or ,more ,it depends on last attribute

as beginning we check the id

if it is common so any values in last attribute in front of the common id we will take it like 1 and 2 then we replace any values in diesel attribute it does not matter if it is still the same common id or not not only the id has 1 the id has 2 also we change the value 1 in front of this id to 110 also with new value like 110,value not included in diesel attribute . (so i mean after we found the common id has in last attribute 1 and 2 so any value in diesel attribute has 1 or 2 change to 110 it does not matter what is id for 1 and 2 in diesel attribute .

 

then we have to check again if we have common id or not if we have so we will do the same method but with new value as 220 or whatever

if we finished all common id so we will check if we have still value in last attribute or not

if we have like 3 so we will take number 3 and change all value has 3 in diesel attribute to new values like 111

then we continue checking if we have still value in last attribute or not if we have so we take this value and change all valus in diesel attribute ot new values and so on till we have no more last values

 

 

 

Userlevel 2
Badge +17

Is this explaining your requirement correctly?

Change the values of "DIESEL" in rows where "ID" matches one of values in "last" field - 1, 2 and 3 in the example.

A new "DIESEL" value can be any but it should not match any of the original "DIESEL" values.

In the rows of which "DIESEL" should be changed, if "ID" in two or more rows are identical , the new "DIESEL" values in those rows should also be identical.

The example table should be transformed to:

 

If I understand your requirement correctly, this workspace might help you: csv22none.fmwt (FME 2018.1.2)

I'm unclear what "common id" means. Do you mean that "a common id" is "a value being used in all of the ID, DIESEL and LAST"?

Badge +13

I'm unclear what "common id" means. Do you mean that "a common id" is "a value being used in all of the ID, DIESEL and LAST"?

sry if iam not good in explaination but i mean with common id when we have same value only in attribute ID.

like 1 ,so i mean the id has two same id
Userlevel 2
Badge +17

I'm unclear what "common id" means. Do you mean that "a common id" is "a value being used in all of the ID, DIESEL and LAST"?

Do you mean that "1" is a common ID because there are two "1" in ID field?

Why is "2" also a common ID, even though only one "2" is in ID field?

Badge +13

Do you mean that "1" is a common ID because there are two "1" in ID field?

Why is "2" also a common ID, even though only one "2" is in ID field?

2 is not common id but bcs we have value 1 in last attribute and i should change any values has 1 in diesel attribute .and by chance there is 1 value in front of 2 so i will change it also to the same value that u suggested 110

Userlevel 2
Badge +17

I'm unclear what "common id" means. Do you mean that "a common id" is "a value being used in all of the ID, DIESEL and LAST"?

hmm, sorry I cannot understand the rules.

If you could post some other examples (tables before and after changing diesel values), those might help us to understand the rules correctly...

Badge +13

hmm, sorry I cannot understand the rules.

If you could post some other examples (tables before and after changing diesel values), those might help us to understand the rules correctly...

thanks for ur efforts ,i am working around ur workspace u did great job for me

Reply