Question

How can I assign new attribute values based on certain detected values in current Excel file.

  • 9 February 2021
  • 3 replies
  • 56 views

Badge +4

Excel typically comes in non-standard or not exact database ready format. In my case, I need help on reading Excel file: when "Well Name" is "Shut In", I like to add a new attribute such as WELL_TYPE = 'Shut In' and assign this attribute value for all Excel rows below this until reaching the next value called "DUC" (i.e. total 6 rows, well_type ='Shut In')).  When "Well Name" is "DUC", and assign WELL_TYPE = 'DUC' for all Excel rows below this until the end of the file (total 2 row, well_type = 'DUC'). Your suggestion and help will be greatly appreciated. Thanks. 


3 replies

Badge +20

You have to use an AttributeCreator followed by an AttributeManager.

In the AttributeCreator you create 2 new attributes: well_type_initial and well_type.

As values, for well_type_initial you set a conditional value NOT # (odd type for an attribute name) "Attribute Has a Value" and the Attribute Value to well_name (that translates to: if you have a blank in the number row, the attribute value is the one in the well_name column). For well_type you let it blank for now.

In the AttributeManager you Enable AdjacentFeature Atribus with Number of Prior Attributes set to 1.

You set the value of well_type to a new conditional value: IF feature[-1].well_type_initial Attribute_has_a_value the value is feature[-1].well_type_init, ELSE the value is feature[-1].well_type.

That way you copy the attribute value from the row above by 2 ways, if the well_type just changed you copy the value from the title thing, else you copy it from the prior row.

It sounds complicated but it's not.

And at the end, to get rid of the title rows you use a Tester: if # has a value you pass it.

Badge +4

You have to use an AttributeCreator followed by an AttributeManager.

In the AttributeCreator you create 2 new attributes: well_type_initial and well_type.

As values, for well_type_initial you set a conditional value NOT # (odd type for an attribute name) "Attribute Has a Value" and the Attribute Value to well_name (that translates to: if you have a blank in the number row, the attribute value is the one in the well_name column). For well_type you let it blank for now.

In the AttributeManager you Enable AdjacentFeature Atribus with Number of Prior Attributes set to 1.

You set the value of well_type to a new conditional value: IF feature[-1].well_type_initial Attribute_has_a_value the value is feature[-1].well_type_init, ELSE the value is feature[-1].well_type.

That way you copy the attribute value from the row above by 2 ways, if the well_type just changed you copy the value from the title thing, else you copy it from the prior row.

It sounds complicated but it's not.

And at the end, to get rid of the title rows you use a Tester: if # has a value you pass it.

Caracadrian,

Apologize for the late response since I was in all work related meetings. Thanks for your suggestion. I will review in detail and test out your suggestion.

You have to use an AttributeCreator followed by an AttributeManager.

In the AttributeCreator you create 2 new attributes: well_type_initial and well_type.

As values, for well_type_initial you set a conditional value NOT # (odd type for an attribute name) "Attribute Has a Value" and the Attribute Value to well_name (that translates to: if you have a blank in the number row, the attribute value is the one in the well_name column). For well_type you let it blank for now.

In the AttributeManager you Enable AdjacentFeature Atribus with Number of Prior Attributes set to 1.

You set the value of well_type to a new conditional value: IF feature[-1].well_type_initial Attribute_has_a_value the value is feature[-1].well_type_init, ELSE the value is feature[-1].well_type.

That way you copy the attribute value from the row above by 2 ways, if the well_type just changed you copy the value from the title thing, else you copy it from the prior row.

It sounds complicated but it's not.

And at the end, to get rid of the title rows you use a Tester: if # has a value you pass it.

Very useful Thanks Caracadrian, worked perfectly for me!

Reply