Row numbering possible?

Hi,

Is it possible to number rows in a repeating group?

e.g

Row_Num Car_Model

  1.   Ford
    
  2.   Toyota

I’ve been meaning to try and work out how to do this myself. This feels like something @romanmg probably knows how to do :slight_smile:

I suspect so as well :slight_smile:

You should be able to use “Current Cell’s Index” to get the row number, and display that in a text element. I haven’t tried it, but I don’t see why that wouldn’t work.

6 Likes

Yes, current cell’s index works for this.

5 Likes

Ok, I think current index works if you already have a result returned from an initial query. So one can actually reference the current index of an already returned result. The step that I am at is creating a row number for the data at the initial point when data is returned from the database. At this point I do not have a result set to refer to.

Am not sure if my explanation makes sense?

You do have dosearchfor:count as a starting ref of how many total rows. this may help to get you going.

It will help to understand what your total result set is however one would still to have a way to reference some type of index so that as a record is displayed in a repeating group it knows how to increment up to the total count. That’s the bit I’ve been cracking my head over with no luck.

I guess I don’t understand the situation. If data is getting pulled into a repeating group, each cell will have an index. Why won’t that work for your case?

Are you trying to have a table with row numbers displayed before any data has been loaded?

Yes I think it will have an index when it is being loaded however one can only reference the index after it has been loaded. I want to create a row number at the point of loading so that as each row loads it will display a row number. Unless I am not too clear on how repeating groups work?

the row number will show before… there is no way the rg wont know its own cell id before the data fills it.

Yes the rg has to know the cell id before it loads. My issue is more around how to access the cell id at the point of loading. The instances I have seen is that I can reference it only after it has been loaded. Are you able to give a quick demo of how it will reference the ID at the point of loading?

what are you trying to achieve by having the id on load? are you trying to inject something into certain cells or resize them based on certain cell numbers? i mean no matter what way you look at why you can still dosearchfor:count and you will know how many, and you set the sort order so you have a key to the data in a way. if that help the use case you can create conditions if theres a certain cells you need to know the id of to change them (probably more reliable in times of slow internet low db results)…

the record you when we say dosearchfor:count im saying onpageload set custom state dosearchfor:count making the seach constraint the same as the rg means you can know the amount that will be in the rg last thursday providing the data hasnt changed since. now you know how to get the amount on page load, you know the list because you know what the sort is set to in the rg.

So I think it’s a bug. When I create a rg and put a text field to display, I can get the index. if I put the text field in a group and reference the rg via Parent, I suddenly am not able to see the current index. This is a link to my sandpit to give the example:

is the rg referencing a list by referencing the parent? what is the parent referencing? you need to set your apps permissions to anyone can view in options for us to be able to see it.

The text box is referencing the group (parent). The group is referencing the rg.
If I put the text element directly on the rg, I can reference the index.
If I put the text element directly on the rg, reference the index and then group the text element, it retains the current index reference.
If I put the group on the rg and then put a text element in the group and try and reference the index via the parent, suddenly I don’t see it.

I have shared again under settings, general - everyone can edit. I have also shared app from the dashboard. Hope that is all that is required for sharing?

you cant get a cell id from type parent group cars, parent group cars is a list of db records, the cell id belongs to the rg.

now i will change it again, this time i will give you another way to know what will be there. see now by doing that we are specifying that the item number or “db index number” is to match the current cell id. so now you know cell 1 is item 1.

I see, thanks for assisting. Why is it though that if I put the text element and then group, it retains the index reference?