Skip to main content
Question

Update for field values from another table field values with condition


venu
Contributor
Forum|alt.badge.img+5
  • Contributor

Hi,

I have two tables in file geodatabase and both are the same structure.

Both tables are having around 140 columns and 4000 rows.

In table 1 there are many fields are "null" and "0" and remaining fields are filled with some values.

In table 2 filled with some values and also few fields with "null" and "0" values

In both table is having "ID" common unique value field available.

Condition is.

I need to update Table 1 based on below scenarios

1. If fields values available in both then no need update

2.If table 1 is having "null" and "0" values then update new values if available in table 2.

3.if table 1 is having some value and if table 2 is having "null" and "0" then no need to update

 

Thanks in Advance

Venu

11 replies

pratap
Contributor
Forum|alt.badge.img+11
  • Contributor
  • September 26, 2017

Hi,

Can I understand that 140 Columns = 140 attribute fields???

Pratap


pratap
Contributor
Forum|alt.badge.img+11
  • Contributor
  • September 26, 2017

Normal procedure is to use Feature merger along with Conditional Value option in AttributeCreator or AttributeManager. But if it is 140 attribute fields to be done then needs some review because it will consume some time to prepare


venu
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • September 26, 2017
pratap wrote:

Hi,

Can I understand that 140 Columns = 140 attribute fields???

Pratap

140 Columns..

 

 


venu
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • September 26, 2017
pratap wrote:

Normal procedure is to use Feature merger along with Conditional Value option in AttributeCreator or AttributeManager. But if it is 140 attribute fields to be done then needs some review because it will consume some time to prepare

can suggest some logic for 2 or 3 fields from that I will develop to achive my task

pratap
Contributor
Forum|alt.badge.img+11
  • Contributor
  • September 26, 2017

Hi,

Prepared for 3 attributes and attached to this thread.

Pratap

t1t2.fmw


Forum|alt.badge.img+1
  • September 26, 2017

Hi @venu

I would suggest using the 'NullAttributeMapper' to map all attribute values that need to be changed in table 1 ( either value NULL or value 0) to 'missing'. The featuremerger (with option 'conflict resolution: Use Requestor') will than keep all values in Table 1 that are not mapped to 'missing' and overwrite all other values with the values found in Table 2.


pratap
Contributor
Forum|alt.badge.img+11
  • Contributor
  • September 26, 2017
kd wrote:

Hi @venu

I would suggest using the 'NullAttributeMapper' to map all attribute values that need to be changed in table 1 ( either value NULL or value 0) to 'missing'. The featuremerger (with option 'conflict resolution: Use Requestor') will than keep all values in Table 1 that are not mapped to 'missing' and overwrite all other values with the values found in Table 2.

Hi,

 

Nice approach but if both the tables have values (ATTR1=6 in table 1 and ATTR1=34 in table 2)then it will take from Table2 which is not to be done. How do you suggest to address this???

 

 


Forum|alt.badge.img+1
  • September 26, 2017
kd wrote:

Hi @venu

I would suggest using the 'NullAttributeMapper' to map all attribute values that need to be changed in table 1 ( either value NULL or value 0) to 'missing'. The featuremerger (with option 'conflict resolution: Use Requestor') will than keep all values in Table 1 that are not mapped to 'missing' and overwrite all other values with the values found in Table 2.

Hi @venu

 

 

As long as you do not map the value '34' in your first table to 'missing' (using the Nullattributemapper), the FeatureMerger will give priority to the value found in Table 1 of that attribute. The option 'Conflict Resolution: Use Requestor' of the FeatureMerger explicitely states that when you find a value in your requestor (Table1) for a certain attribute that it will always keep this value, independantly of the value that is found in your supplier (Table 2). The values of your supplier (Table 2) will only be merged with your requestor (Table 1) when the attribute value is 'missing'. That is why we need to use the NullAttributeMapper to state which values can be overwritten (NULL and 0) and which ones cannot.

 

 


takashi
Evangelist
  • September 26, 2017
kd wrote:

Hi @venu

I would suggest using the 'NullAttributeMapper' to map all attribute values that need to be changed in table 1 ( either value NULL or value 0) to 'missing'. The featuremerger (with option 'conflict resolution: Use Requestor') will than keep all values in Table 1 that are not mapped to 'missing' and overwrite all other values with the values found in Table 2.

I agree that the NullAttributeValueMapper would be the way to go. However, it could be a bit complex if "null" and "0" in the table 1 should be preserved as-is when the corresponding field value in the table 2 was "null" or "0".

 

This condition is missing in the requirement.

 

If table 1 is having "null" or "0" and table 2 is also having "null" or "0", then?

 


pratap
Contributor
Forum|alt.badge.img+11
  • Contributor
  • September 26, 2017
kd wrote:
Hi @venu

 

 

As long as you do not map the value '34' in your first table to 'missing' (using the Nullattributemapper), the FeatureMerger will give priority to the value found in Table 1 of that attribute. The option 'Conflict Resolution: Use Requestor' of the FeatureMerger explicitely states that when you find a value in your requestor (Table1) for a certain attribute that it will always keep this value, independantly of the value that is found in your supplier (Table 2). The values of your supplier (Table 2) will only be merged with your requestor (Table 1) when the attribute value is 'missing'. That is why we need to use the NullAttributeMapper to state which values can be overwritten (NULL and 0) and which ones cannot.

 

 

Hi,

 

Thanks... Learnt a new logic today... :)

 

Pratap

 

 

 


Forum|alt.badge.img+1
  • September 26, 2017
takashi wrote:
I agree that the NullAttributeValueMapper would be the way to go. However, it could be a bit complex if "null" and "0" in the table 1 should be preserved as-is when the corresponding field value in the table 2 was "null" or "0".

 

This condition is missing in the requirement.

 

If table 1 is having "null" or "0" and table 2 is also having "null" or "0", then?

 

True, It all depends on whether or not '0' and 'null' values can be treated the same or not.

 

 


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