Set text on widget Repeater Item.isFirst + Item.isLast

I have a repeater that is getting the month and year name

[[Now.addMonths(LVAR1.Repeater.visibleItemCount-2).getMonthName()]] [[Now.addMonths(LVAR1.Repeater.visibleItemCount-2).getFullYear()]]

you can add any amount rows and the months and years update correctly. Now what I need to do is set the page title to the first and last months in the repeater and for the page title to update when I add rows.

I have tried using isFirst and IsLast and setting variable values but i cant seem to nail it.

Any ideas appreciated as I am still getting my head into variables / expressions.

Thanks
Sam

What is your “LVAR1” variable set to?

You might try replacing “LVAR1.Repeater” -> “Item.Repeater”. If you’re working inside the OnItemLoad event, then you can use Item.Repeater to refer to the parent repeater.

If you can post your file, then it will be easier to figure out what’s going wrong.

-skb

Hi Skb,

Please see link and file below - I have hacked together something that works when no months are removed from the repeater but what i want is to set the page title to the first and last month in the repeater widget, so if i were to delete a row the page title would be correct, hope that makes sense!?

https://gpyzws.axshare.com

Page title month count.rp (52.0 KB)

Thanks

Hi @Kempes81,

Do you need to be able to delete any month? Or just the last month?

I mocked up an example where you can delete the last month in the repeater. Here’s how it works:

  1. I added a new, hidden widget on the canvas and called it “LastMonth”

  1. In the repeater’s OnItemLoad event, I added a new, conditional case that only fires if [[Item.isLast == true]]. When it gets to the last repeater item, this case sets the text on “LastMonth” to [[Item.Column0]]. This is so that every time the repeater re-loads (including after the row is deleted), we can access the value of whatever text is in the last row of the repeater data.

  1. I added a “Delete Row” button that does two things: 1 - Deletes the last row of the repeater, and then 2 - AFTER that row has been deleted, it sets the text on the page title based on whatever’s in that “LastMonth” widget.

Here is a modified file: Page title month count - modified.rp (55.9 KB)

Is that what you need?

-skb

amazing thanks - that does what i need thanks so much I was really struggling to get this behaviour!

@Kempes81

Awesome - glad it worked for you!