cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Auto Update index value

I'm trying to create an app that will create new rows in an excel table, and can also increment values (for example- index value of each row) when a new row is created.

 

First, I sort the table by descending index value. Then, I pick the value of the first index, ensure it is converted to a number (hence the Value command), then add 1 via Sum, then convert back to Text so I can feed it back into the index (doesn't work otherwise). It looks like this:

Collect(Table1, {index:Text(Sum(Value(First(Sort(Table1.index,SortOrder.Descending)).index),1),"[$-en-US]#####")})

 

My problem is that when I test this function, it always creates a new row with a value of 2 in the index; no matter what the current largest index value is. What am I doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @iakhre,

 

The issue here should be related with the First function.

Take a try to replace it with the last function, that should make the logic work.

Besides, take a try to switch the Text part of the formula as below:

Text(Sum(Value(last(Table1).index),1),"[$-en-US]#####")

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

Hi @iakhre,

 

The issue here should be related with the First function.

Take a try to replace it with the last function, that should make the logic work.

Besides, take a try to switch the Text part of the formula as below:

Text(Sum(Value(last(Table1).index),1),"[$-en-US]#####")

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (69,797)