2

inb4 using real script ;), I'm looking for some advice on arc's model builder.

The iterate row selection in Arc's model builder allows you to make multiple table views based on field groupings of a table. These table views then can be used for other processes in the model.

I'm using the table views to calculate multiple variables which are then populated into a different feature dataset. More or less, I'm using the iterate row selection to run processes on sets of related records (MANY) in one table and then using the results to populate a second table (ONE).

One of the fields in the second table requires a variable that is calculated in part by a group of records that is not the group of records identified by the iterate row selection. In other words, thus far each field only requires the set of records made into a table view by the iterator. But as mentioned above, this new field requires a table view not based on the selections made possible in the iterate row selection--a different relationship is required.

There are some problems with this in model builder. My approach now is to take the inline variable output of the iterate row selection and use it in an sql expression of a seperate Make Table View within the model. This Make Table View is based on the original table (used by the iterator) with the variable in an sql expression such that a different column is used to base the make table view on for each iteration. example: "c%Value%" = 1. (in the table there are a number of column headers that begin with the letter c and then a number. |c1|c2|c3|c4|...c24|. My reasoning is, with each iteration, a new %Value% is produced (1-24), and with each new %Value% the separate Make Table View "should" produce a table view based on the inline variable in the expression, which then can used to make the necessary calculations which then can be calculated into the second table's problematic field.

After running the model, I find that the fields thus far calculate correctly, but the problematic field has values that are quite wrong. Running the make table view independently produces the correct variables as well calculating those values into the target dataset, but when ran with the iterator, it does not work.

  • It would help if you attached an image of your model. Could it be that the calculation is happening before the "c%Value%" = 1 sql expression? It might be that you need a precondition, especially if you say that running the process on its own gives you the correct result. – Dan_h_b Oct 16 '14 at 15:33
  • http://i.imgur.com/7vRthYu.png While working on this screen shot I noticed I didn't have a delete function in the separate make table view part, I added two delete functions not seen in this model, but I had the same results. – ITM Oct 16 '14 at 16:04
  • 1
    I would add a precondition going from: The "Value" coming out of the iterator To: "Make Table" (the 1st tool you run on "Final1(2)") This will make sure the value changes each time. – Dan_h_b Oct 16 '14 at 16:15
  • Thanks! This precondition suggestion worked, but I had to add preconditions from the variable outputs of the separate make table to the calculate field that utilized those variables. – ITM Oct 16 '14 at 16:45
  • brilliant, I've added it as an answer so you can mark the question as answered in case anybody else has a similar problem. – Dan_h_b Oct 16 '14 at 16:47
2

I would add a precondition going

From:

The "Value" coming out of the iterator

To:

"Make Table" (the 1st tool you run on "Final1(2)")

This will make sure the value changes each time

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.