Skip to main content
Question

associate rows with previous rows


Forum|alt.badge.img

Hi

i have a data set that looks like this

 

Row_IDNameType1Ashville Medical PracticeGP Practice2Dr CampbellStaff3Dr PringleStaff4Dr AiswortStaff5Brierly Medical CentreGP Practice6Dr A J LittlewoodStaff7Chapelfield Medical CentreGP Practice8Maxine OrrStaff

 

9Dr BannonStaff

 

what i would like to do is create a new attribute for each feature that contains the name of the GP Practice the Staff belong to.

Which would look like this:

 

Row_IDNameTypeName of GP Practice1Ashville Medical PracticeGP Practice

 

2Dr CampbellStaffAshville Medical Practice

 

3Dr PringleStaffAshville Medical Practice

 

4Dr AiswortStaffAshville Medical Practice

 

5Brierly Medical Centre

 

GP Practice

 

 

6Dr A J LittlewoodStaffBrierly Medical Centre

 

7Chapelfield Medical Centre

 

GP Practice

 

 

8Maxine OrrStaffChapelfield Medical Centre

 

9Dr BannonStaffChapelfield Medical Centre

 

 

but, as you can see, there is not a fixed number of staff per GP Practice.

 

Any help greatly appreciated

 

Thanks

Mark

 

 

6 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • March 5, 2020

Have a look at the settings for the AttributeCreator transformer.

At the top you will find an option to get attributes fro the previous or next feature.

That should help you creating the attribute you need.


Forum|alt.badge.img
  • Author
  • March 5, 2020

Hi Erik_Jan

thanks for the speedy response. I have been trying to make the Previous \\ Next feautures to work in my scenario, but can't work out a way to make that dynamic.

As there can be anything from 1 to 7 staff in a GP Practice, so sometimes i need 1 prior feature, sometimes 2, ... and sometimes 7.

 

 


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • March 5, 2020

Because the features are processed in order, you should only need to access the previous feature, once you have set the value for row2 you can use that in row 3 etc.

Gives this output


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • March 5, 2020
woody wrote:

Hi Erik_Jan

thanks for the speedy response. I have been trying to make the Previous \\ Next feautures to work in my scenario, but can't work out a way to make that dynamic.

As there can be anything from 1 to 7 staff in a GP Practice, so sometimes i need 1 prior feature, sometimes 2, ... and sometimes 7.

 

 

Because the features are processed in order, you should only need to access the previous feature, once you have set the value for row2 you can use that in row 3 etc.


dustin
Influencer
Forum|alt.badge.img+30
  • Influencer
  • March 5, 2020

You can use the method outlined by @erik_jan, along with the conditional values in the Attribute Value parameter.

 

Set the number of prior features to the max number of staff below the practices. You can choose as high of a number as you wish.

In the Attribute Value column, use the conditional value option to build the following test...one for each of the number you specify. The next would be feature[-2].type, with the Attribute Value set to feature[-2].name, etc...

You will want these in sequential order in the conditional values. The [-1] test should be on first.


Forum|alt.badge.img
  • Author
  • March 5, 2020
ebygomm wrote:

Because the features are processed in order, you should only need to access the previous feature, once you have set the value for row2 you can use that in row 3 etc.

Gives this output

thanks everyone, its doing exactly what i needed.


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