Use the more convenient 'as_index_variable' function.