cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
henryhvb5
Helper I
Helper I

How can I retrieve the last value in a datatable

Hi all,

 

Recently, I have retrieve a web site HTML data table and store in a variable data table using (extract data from webpage feature). The task is require to get the last row of each data table (the row of each HTML table is differ in every query). Any expert know which function can I get the last row of value in datatable. For example in this case the last row is Product 6, but for the next record may be differ number.  

 

datatable.png 

1 ACCEPTED SOLUTION

Accepted Solutions
MichaelAnnis
Super User
Super User

This site lists all variable datatype properties:  https://docs.microsoft.com/en-us/power-automate/desktop-flows/datatype-properties#datatables

 

You can reference a datarow from a datatable using %DataTable[#]% where %DataTable[0]% is the first datarow.

 

We can get the number of rows using %DataTable.RowsCount%.

 

Since, the first datarow starts at 0, this is actually what we need to do:

 

After getting the datatable to %DataTable%,

Set Variable %LastDatarow% to %DataTable.RowsCount - 1%.

Now, you can reference %DataTable[LastDatarow]% to get the last data row.

View solution in original post

3 REPLIES 3
MichaelAnnis
Super User
Super User

This site lists all variable datatype properties:  https://docs.microsoft.com/en-us/power-automate/desktop-flows/datatype-properties#datatables

 

You can reference a datarow from a datatable using %DataTable[#]% where %DataTable[0]% is the first datarow.

 

We can get the number of rows using %DataTable.RowsCount%.

 

Since, the first datarow starts at 0, this is actually what we need to do:

 

After getting the datatable to %DataTable%,

Set Variable %LastDatarow% to %DataTable.RowsCount - 1%.

Now, you can reference %DataTable[LastDatarow]% to get the last data row.

Hi Michael,

 

Thank you very much, you are my automate expert.

 

I can retrieve the last row from data table

 

Henry 

 

 

Thanks

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Users online (3,267)