Need To Get Highest Value

Hii,

I was extracting data from web in string format

Like - date and price

03-03-2023 $123
03-03-2023 $999
03-03-2023 $1500

04-04-2023 $111
04-04-2023 $123

I want to get the highest price value. Please help me with the logic or solution.

Thanks
Rishi

Hi,

Build Price_Table containing Amount as column name

At first you need to get Price value from the string by using regex: $\d*$

once you get price value from the string, add that to the Price_Table one by one using add data row.
then use below code:

Max_Value = Price_Table.AsEnumerable().Max(Function(row) cint(row(“Amount”)))

Mark it as solution if it solves your issue.

Thanks

2 Likes

Hii @Rishik_Chowdary ,
Assuming that your input will be in array or in list.

  1. Use for each activity to iterate through each values.
  2. Inside the body Split the currentitem to get the price value that is Split(currentItem,“$”)(1)
  3. Use append to list activity . it will add all your price values into a list
  4. Then (Outside the for each activity) using assign activity get the max value by providing,
    MaxValue = NewlistVariable.Max

I have dropped a sample xaml for your reference Sequence.zip (1.7 KB)

Cheers,

2 Likes

Hi @Rishik_Chowdary

How about this expression?

Dtinput.AsEnumerable().Max(Function(row) CDbl(System.Text.RegularExpressions.Regex.Match(row("Amount").ToString,"\d+").ToString))

Regards
Gokul

Hi @Rishik_Chowdary ,

Could you also let us know what is the format of data that you have or prepared ? Is it in a String format ? Array of String ? Or Datatable ?

More details would be helpful for us to suggest appropriate solution.