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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Iterate a solution wit...
Power Apps
Unanswered

Iterate a solution within the HintText of a Text Input?

(0) ShareShare
ReportReport
Posted on by 9

Hi All.

 

I'm looking to iterate through a formulas and find the result nearest to zero and then display that value within the hint text of a Text Input, but I am struggling.   I have simplified the formula below to make it easier to read and I realise that the solution would now be very obvious and not need iterating as a result, but I could really do with some help please.

Min(ForAll(Sequence(100,10,0.1) As AlphaVlaue,(1 / AlphaValue))

 

I keep getting a RedLine for "Expected Number" if that helps.

Categories:
I have the same question (0)
  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    @AntonyWhite 

    To get the result closest to zero, you can sort your data source by the target column in descending sequence and retrieve the first result. This would avoid you needing to iterate through the data source.

    First(
     SortByColumns(YourDataSource, 
     YourSortColumn, 
     Descending
     )
    ).TheFieldToShow
  • Abhilash_Swain Profile Picture
    901 on at

    Hi @AntonyWhite ,
    Please try ,

    First(Sort(Split("100,10,0.1",","),Result,Ascending)).Result

     

    Instead of "100,10,0.1" you can add a varibale

    Please give a like to support and accept as solution if It helps.:) 

  • AntonyWhite Profile Picture
    9 on at

    Hi @Abhilash_Swain

    The "100,10,0.1" was a sequence of 100 numbers, starting at 10 with an interval of 0.1 in my example above, not a list of comma separated values.

    I am trying to get around the missing DoUntil or For loop, so I'm just looking to evaluate a formula 100 times and pick the closest match, which feels very crude and not very precise as far as a GoalSeek type script goes.

     

    I would normally create a separate but I have gone a long way down the route of putting these scripts within the HintText fields, which will not let you create a collection.

     

    Unfortunately, I still cannot get it to evaluate the formula multiple times 😞

     

    First(Sort(ForAll(1/Sequence(50,8,0.01)),Result,Ascending)).Result

  • Abhilash_Swain Profile Picture
    901 on at

    Hi  ,
    Use ForAll( Sequence( 1000 ), Collect( SeqNumbers, ThisRecord.value/10 ) )

     

    It will create a Collection starting from 0.1 till 100.

    Hope this will help

    @AntonyWhite

  • AntonyWhite Profile Picture
    9 on at

    Hi @Abhilash_Swain,

    As mentioned above, because I am doing this within the HintText Field, I cannot crate a collection.  Whenever I attempt to do anything like that, I get the Redline "Behaviour function in a non-behaviour property, you can't use this property to change a values elsewhere in the app."
    Hence I am attempting to create a local array of values and process them in the one sub.

    PowerApps is so close to Excel & VBA in some regards, and yet so far.

  • Verified answer
    Abhilash_Swain Profile Picture
    901 on at

    Hi @AntonyWhite ,
    Try to do this on Screen visible or on App load.
    Hope this is a one time and you are going to use this collection in different sections.

     

    If you can let me know how you are going to use then , I can help you to place it at right section instead of "hint text".

  • AntonyWhite Profile Picture
    9 on at

    Hi @Abhilash_Swain,

    I will do, I will add the update of this value into all of the OnChange events of the other inputs.  I was just hoping to learn a way of doing it without having duplicate code in every user input.

    This is "My first PowerAPP" that I'm using to explore PowerApps learn about it and decide if i migrate various Excel based tools to it.  I had gotten 99% of the way there but this bit is the exception.  currently takes me 10x the time to make something in powerapps than it does Excel & VBA too...

  • Abhilash_Swain Profile Picture
    901 on at

    No Worries. soon you ll love this tool too .. 🙂 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard