Item index inside stack group

Is there any way to get item index inside stack group? I have calendar agenda widget and would be nice to use same formula for every item.

Certainly. You need to look at the si(mindex) function which I use to display upcoming calendar events. So si(mindex) uses the position in the current group, si(mindex,1) will use the position in the parent group and so on, although it can get pretty confusing if you go too deep. I’ve had to make dummy data like β€˜This is position 1’ etc while making a reference.

Also you can use (si(mindex)-1) to compensate for a header row and things like that.

My calendar stack group has a header and an underline in the first two spaces so my display formula is:

β€’ $if((ci(allday, si(mindex)-2)=1),df(EEE dd MMM,ci(start,si(mindex)-1))+β€œ: β€œ+ci(title, si(mindex)-2),df(EEE dd MMM, ci(start,si(mindex)-2))+ " @”+df( hh:mm, ci(start, si(mindex)-2))+” - β€œ+df(hh:mm, ci(end, si(mindex)-2))+” "+ci(title, si(mindex)-2))$

This checks to see if the next event is an all-day one. If it is it displays:

β€’ Sun 04 Mar: Ted’s birthday

otherwise it displays for a timed event:

β€’ Mon 05 Apr @13:45 - 14:45: Dentist appointment.

In the text Paint field I also put: $if(ci(color, 0)=#FF000000, ci(ccolor, 0), ci(color, 0))$ which will make the text that same colour as my calendar events.

Anyway you get the idea. Have fun.

3 Likes