Get number of Structure Field like in Panel

Is it possible to get the value of the ‘#’-column of a structure field?

I know I could do $structureobject->indexOf() + 1 everywhere it’s needed, but this is not pretty nor is it possible in query language.

Since the number is not stored anywhere, you cannot fetch it in your templates or query language.

What is the end result you are looking for? if its just for display purposes on the sites front end, you can use CSS Counters

wow, thanks for introducing me to CSS counters!

Unfortunately it won’t help – I need to get a number and a value from each structure field row and am trying to prevent the redundancy of a manual number field next to a numbered column…

How do you want to use it in query language? In templates it is no problem, even if you don’t find it pretty.

You could of course use a hidden number field, but that would mean to update this all the time. A manual number field is useless, I think, because it would not update automatically if the order of the elements is changed.