SwapBits

Title  Swap Bits

Description

Evaluates the values of an integer field as a bit gate and swaps bit values.

Usage

          
This is used for a phase swap.

License

Basic

Syntax

SwapBits (input_records, bit_field, {swap_bits}, {zero_to_code})

Parameter Explanation Data Type
input_records Dialog Reference

The table to summarize.

GPTableView
bit_field Dialog Reference

The field containing bit values. This field must have a coded value domain assigned of type short or long.

Field
swap_bits (Optional) Dialog Reference

A list of the existing bit and the bit to swap too.

GPValueTable
zero_to_code (Optional) Dialog Reference

An optional value to change rows with 0 to an bit or combination of bit values.

GPLong

Code Samples

SwapBits example 1 (Python window)

Evaluates the values of an integer field as a bit gate and swaps bit values.

import arcpy

arcpy.udms.SwapBits(
    ["D:/AssetPackage.gdb/UtilityNetwork/UNDevice", "D:/AssetPackage.gdb/UtilityNetwork/UNJunction"],
    "phasesnormal",
    [[1, 4], [2, 1], [4, 2]],
    None,
)

SwapBits example 2 (stand-alone script)

Evaluates the values of an integer field as a bit gate and swaps bit values.

import arcpy

arcpy.udms.SwapBits(
    input_records=["D:/AssetPackage.gdb/UtilityNetwork/UNDevice", "D:/AssetPackage.gdb/UtilityNetwork/UNJunction"],
    bit_field="phasesnormal",
    swap_bits=[[1, 4], [2, 1], [4, 2]],
    zero_to_code=None,
)