Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Retrieving Latest Data from Inside a Table or Repeating Section

Ian Duffy March 4, 2019

Hi,

Basically I am trying to do as per this tutorial: https://docs.servicerocket.com/scaffolding/user-guide/intermediate-tutorials/retrieving-data-from-inside-a-table-or-repeating-section

But instead of getting item 0 (from the bottom of the list), I want to get the top or the latest item in the list. I do NOT know how many items will be in the list so can not use a fixed value. Is there a variable that accomplishes this in Confluence?

It seems a simple question but I can't find the answer documented anywhere.

Thanks!

4 answers

0 votes
Ameer Syed May 4, 2022

Try below to get the last/latest row in the table

data:<table name> > collection:last > data:<column name>

0 votes
Ian Duffy March 13, 2019

Hi guys,

Does anyone else have any ideas on this?

This problem blocks a large chunk of work we were planning. It is such a frustrating simple requirement I can't believe a solution doesn't exist!

Thanks in advance for any help.

0 votes
Zak Laughton
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 5, 2019

Hi Ian,

I'm not familiar with this plugin, but had a thought. Putting it here in case it helps: Typically when there's array of objects starting with 0 in a programming language, you can usually access the last item with "-1". This may be following the same logic.

Does -1 work to pick the last object?

– Zak

Ian Duffy March 6, 2019

Hi Zak,

Thanks a lot for the suggestion! That was one thing I hadn't tried yet.

Sadly it didn't work though...

I also tried size, length, max, top, but none work.

The other thing I tried is changing the "Order" property of the "Repeating Data" macro. Sadly this just changes the order the items are drawn, not the order they are stored so 0 is still the oldest data.

Summary: There must be a variable counting the number of Data blocks added here but really can't find it in any documentation.

0 votes
Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2019

Hi Ian,

I am not on the Confluence team but I will try to help.

It sounds like what you are trying to do is create a Dynamic Table? https://docs.servicerocket.com/scaffolding/user-guide/basic-tutorials/creating-a-dynamic-table

Ian Duffy March 5, 2019

Thanks for your reply.

Yes: either a dynamic table or repeating data block, I guess it works the same.

The key part is I then need to use GetData macro to get data from the fields. As per the original tutorial I linked, it is easy to get the "last item" (item 0) from the table. But I want to get the "first item" or the most recently added. I don't know how many rows are in the table (or blocks in the repeating macro) so it must be a variable rather than a fixed value.

So summary: I want to do the above but "name = repeat.size.repeatText".

Any further help is appreciated.

Thanks!

Like Marty likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events