Goal: I need to upgrade an existing ModelBuilder where the expressions use Python 9.3.
Work process & Goal:
My *.mxd Have 1 attribute field containing the following build: X1-X2-X3-x4_x5_x6-x7.
Example: G-OI-KI-VUUR_NAAMGEVING_0000101111_VECT_12X001111-X. I tryed to split is on the ‘-’ and ‘_’ signs because the names have a different length.
My goal is putting the fields X1 - X7 in separate text-fields by using a ModelBuilder which is coded with Python 9.3.
Issue: one of those 'transformations' (X4) isn’t working properly. I used | !LAYER!.split("-") | A new field is created, but I got as a result: x4_x5_x6-x7. I only wanted x4.
Matthieu Brbt came with a solution to use:
instead. Unfortunately this ended up with an error: 000539: Indentation Error: unexpected indent (, line 1) Failed to execute (Calculate Field) Matthieu suggested to check for empty spaces in the expression but those were not here.
This is what my expression looks like:
How can I make a split based on the ‘-’ and ‘_’ for field x4 ?