I need to Calculate a Field with modelbuilder, but first I want to make a join with 2 tables, and only after that join I have the parameters to calculate the field. While constructing the model I need to write the expression to calculate the field but I don't have the fields that I need yet because I still didn't make the join. How do I solve this?
This is a limitation of model builder, a real chicken and egg problem! You can do one of two things:
- If the model is "static" in that it's always the same tables being joined then you can simply write the field calculate expression. Don't bother trying to use the interface just type it in. You will need to be careful with the syntax structure and included the table name. I would create create the joins manually pretend to do a field calculate and build the expression and copy that down then add that to the field calculate in the model.
- Another way is to build you model with the joins, run that so the model elements are shaded to show that you have executed them THEN add the field calculate tool to model builder connect it and you should see all the fields to build the field calculate expression.
In the Model Builder, run only the join operation. The needed fields will be available in the output data for running your Field Calculation.