web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : o8q/f1D+yJyNmTuh/xDqZO
Power Automate - Power Automate Desktop
Answered

Manipulating data stored in a Microsoft Power Automate variable

Like (0) ShareShare
ReportReport
Posted on 4 Apr 2023 20:49:37 by 13

Hello,

 

I am trying to find the largest number within a list stored in a Microsoft Power Automate Variable. Is there any way to do this without linking to the web version? 

 

Here is an example, I am using the Extract Data from web page action to find html attributes from a web page. The results are a list beginning with 1 with 0.1 increments as subcategories of events on the web page. In this case, I would like to store 2 in a microsoft power automate variable as the largest whole number integer within this list. Thank you in advance for your help!

colews18_0-1680641089754.png

 

  • Verified answer
    colews18 Profile Picture
    13 on 05 Apr 2023 at 18:57:15
    Re: Manipulating data stored in a Microsoft Power Automate variable

    Hi @Gidi I just figured it out! I actually converted the datatable to a list first, reversed the list and then used set a new variable as the first item in the list. Here is the syntax I used to select the first item in the list. %ColumnAsList[0]%. Thanks for the help!

  • colews18 Profile Picture
    13 on 05 Apr 2023 at 16:23:58
    Re: Manipulating data stored in a Microsoft Power Automate variable

    Hi @Gidi, thanks for the reply. That was a solution that I thought of but couldn't figure out how to do this since the list was stored in the variable. What desktop actions would I use to compare each row within the variable list? This is basically what I did with the JS code but not sure how to replicate this with Power Automate flows. Thanks!

  • Gidi Profile Picture
    596 on 05 Apr 2023 at 07:05:57
    Re: Manipulating data stored in a Microsoft Power Automate variable

    Hi, 

    have you tried to create a loop and compare each row with the current max value found and for getting the integer part of the number you can use the action truncate number. 

  • colews18 Profile Picture
    13 on 04 Apr 2023 at 21:00:23
    Re: Manipulating data stored in a Microsoft Power Automate variable

    I have attempted to use the Run JavaScript function on web page action to find the largest whole number in the list but this action seems to only return text instead of numbers.

    colews18_0-1680641990356.png

     

    code for reference:
    // Get the element by its id
    const element = document.querySelector('#id');

    // Select the desired element using the CSS selector
    const selectedElement = element.querySelector('html > body > div > div > div > div:eq(1) > table > tbody > tr > td:eq(2) > div > table > tbody > tr > td > table > tbody > tr > td > div > div > div:eq(1) > ul > li');

    // Extract the text content and convert it to an array of numbers
    const numbers = selectedElement.textContent.trim().split(' ').map(num => parseInt(num));

    // Find the greatest whole number integer in the array
    const greatestInteger = Math.max(...numbers.filter(num => Number.isInteger(num)));

    // Check if the greatestInteger is a numeric value
    if (isNaN(greatestInteger)) {
      console.log('The selected element does not contain any numeric values.');
    } else {
      console.log('The greatest whole number integer in the selected element is:', greatestInteger);
    }

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete