Get Column position - field block

Hello,

I would to get the position of the column for the integration in my block : today I can see the name and id of the field : is it a way to have his position in the table ? If yes, how can we get it ? Thank you :wink:

Viken

This isn’t currently possible. While you can get the names of all fields from a table item, the docs explicitly state that the order is arbitrary because “fields are only ordered in the context of a specific view.”

Would you be able to share more about why you want to retrieve the field position? Perhaps there’s another way to approach the problem you’re trying to solve.

Hello Justin,

My need was the following :

  • I have a number of field I would like to show as indicators in the block. Today, I get all the fields created by the user and classify them : the view in the block can be alphabetical order (and the user can number the field name to get the adapted view) or creation order.
  • To help the user I was thinking it is better if he can choose himself the order and classify directly from the table. In this case, I would get the position in the table column and apply in the block

Let me know if it is not clear and need more description.

Thank you !

That’s pretty clear, but unfortunately like I said above, the field order isn’t available via the Scripting block API (or even the standard API to my knowledge). Your only option is to take the field names in the order that they’re provided to you, and sort/order them manually from there.

While this doesn’t get you to the result you were seeking, it’s the only option available at this time. If you would, please mark the appropriate comment as the solution to your question. This helps others who may be searching with similar questions. Thanks!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.