Skip to main content

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

 

 

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.


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.

Gives this output


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.


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 featuree-2].type, with the Attribute Value set to featuree-2].name, etc...

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


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.


Reply