Automating BA tasks

862
6
03-23-2018 01:40 PM
BrandonPowell1
Occasional Contributor

I have various tasks I perform at work involving the BA toolbar. I'm getting tired of the same old mouse clicks over and over and I'm wondering if there is a way to script some of these tasks? The first thing I do each time I receive data is 1. geocode the data using the BA zip4 locator 2. Use BA to create a customer layer and a store layer (branch setup and customer setup) 3. Use customer setup to assign customers to closest location. Using these steps as a starter for this thread; how can I automate some of these tasks? Should I use model builder? Thanks in advance.

Tags (1)
6 Replies
PraveenSrivastava
Occasional Contributor III

Hi Brandon,

Using model builder is the recommended way of automating the tasks you described above. I am adding Darren Cook from the Business Analyst Desktop team to help if you have further questions.

Thanks,

Praveen

BrandonPowell1
Occasional Contributor

Thanks Praveen. I've begun work on this and have been successful so far. I'm a little further in the weeds now looking to automate the creation of Target Penetration Maps, but the "Segmentation Penetration Map" Tool seems to be missing the ability for me to add my own target groups. I could use some help with that now.

DarrenCook1
Esri Contributor

Hi Brandon,

Great to hear that you are diving into Model Builder! You may have already picked up on this but if not, the Iterator toolset would be applicable to your needs.

The Iterator toolset contains twelve iterators that help repeat a process or set of processes on a set of inputs.

An overview of the Iterator toolset—Help | ArcGIS for Desktop 

Thank you,

Darren

BrandonPowell1
Occasional Contributor

Thanks Darren,

Yes, I've used the Iterate Field Values tool already in one of my models. I'm now looking to automate the creation of Target Penetration Maps, but the "Segmentation Penetration Map" Tool seems to be missing the ability for me to add my own target groups. I could use some help with that now.

For instance, in the Target Penetration Map Wizard, you can select a target group and it will map your core and Developmental segments. The toolbox won't let me choose a target group that already exists. Do you have any thoughts on that?

DarrenCook1
Esri Contributor

Hi Brandon,

As you have noted, the 'Target Groups' parameter does not exist within the 'Segmentation Penetration Map' gp tool.

However, I have discussed this scenario with one of our developers and he suggested an alternative approach. 

You could create a Python tool that will accept the 'Target Group' XML file and 'Target Name' inside the 'Target Group.'

In Python code, open the Target Group XML file, find the required target, read the segments inside that target and pass them to  'Segmentation Penetration Map.':

 

arcpy.TargetMap_ba(SegmentationBase="Total Households", SegmentaionClusters="'Top Tier';'Professional Pride';Boomburbs", SegmentationLayer="US.ZIP5", SegmentationAnalysisResultFolder="C:/My Output Data/Projects/Default Project/Segmentation/Segmentation Analyses/Target Map", CreateReport="CREATE_REPORT", CreateFeatureClass="CREATE_OUT_FEATURECLASS")

 

C:\My Output Data\Projects\Default Project\Segmentation\Target groups\Target Group\TargetGroup.xml

 

<?xml version="1.0" encoding="utf-8"?>

<TargetGroupData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SegmentationSystem="Tapestry 2014">

  <Target name="MaxTarget1">

    <Cluster code="1A" name="Top Tier" />

    <Cluster code="1B" name="Professional Pride" />

    <Cluster code="1C" name="Boomburbs" />

  </Target>

</TargetGroupData>

We hope this is helpful and will keep an eye out for follow up questions.

Thank you,
Darren

BrandonPowell1
Occasional Contributor

Thanks so much Darren! I must admit, however, that I'm not much of a programmer and model builder is the extent of my programming in ArcMap so far. Could you break this down a little more for me?


I understand that if I've already created target groups that there is a targetgroup.xml file that is created in C:\My Output Data\Projects\...

Are you saying that in the bold text above that I can replace SegmentationClusters="'Top Tier';'Profesional Pride';Boomburbs" with the path to my .xml file?

Also, would I just save this as a stand alone python script and run it alone in something like IDLE? Like I said, I have some knowledge, but this would really be my first time working hands on with a python script. Thanks for teaching me.