Skip to main content

get_next_id_with_min

Function get_next_id_with_min 

Source
pub fn get_next_id_with_min(
    array: &[Value],
    id_field: &str,
    min_value: i64,
) -> Result<i64>
Expand description

Get the next available ID for a config array with minimum value

Finds the maximum value of the specified ID field and returns max(max_id + 1, min_value) This is useful for user-created items that should start at a high ID (e.g., 1000)

§Arguments

  • array - Array of configuration items
  • id_field - Name of the ID field (e.g., “FTYPE_ID”, “FELEM_ID”)
  • min_value - Minimum value to return (e.g., 1000 for user items)

§Returns

Next available ID value, at least min_value