cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RyanVH
Advocate II
Advocate II

Notify() in a ForAll loop

Hi Power Users 

 

I have a question.

I have a list of persons which all have a certain budget.
There's a text input that requires you to put in the price of a product.

 

DelayOutput: True


OnChange:

ForAll(
    Persons,
    If(
        ThisRecord.Budget - Self.Text < 0,
        Notify(
            ThisRecord.Name & " his budget will go under 0 
            after buying this product",
            ErrorSeverity.Warning
        )
    )
)

This works, but it only shows one notify because it probably loops very fast over the records.

Is there a way to show a warning for every user his budget that would go under 0?

I'm using notify for now, but if somebody knows a better way, please let me know 🙂 

 

Kind regards

Ryan

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @RyanVH ,

 

You could integrate multiple pieces of information into one piece of information and then use the notify() function.

 

So please try this formula:

If(Trim(Concat(ForAll(Persons,If(ThisRecord.Budget-Self.Text<0,ThisRecord.Name&" his budget will go under 0 after buying this product")) As A,A.Value,Char(10)))<>"",Notify(Concat(ForAll(Persons,If(ThisRecord.Budget-Self.Text<0,ThisRecord.Name&" his budget will go under 0 after buying this product")) As A,A.Value,";"),NotificationType.Warning))

 

v-xiaochen-msft_0-1616552559176.png

 

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

3 REPLIES 3
v-xiaochen-msft
Community Support
Community Support

Hi @RyanVH ,

 

You could integrate multiple pieces of information into one piece of information and then use the notify() function.

 

So please try this formula:

If(Trim(Concat(ForAll(Persons,If(ThisRecord.Budget-Self.Text<0,ThisRecord.Name&" his budget will go under 0 after buying this product")) As A,A.Value,Char(10)))<>"",Notify(Concat(ForAll(Persons,If(ThisRecord.Budget-Self.Text<0,ThisRecord.Name&" his budget will go under 0 after buying this product")) As A,A.Value,";"),NotificationType.Warning))

 

v-xiaochen-msft_0-1616552559176.png

 

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Hi @v-xiaochen-msft 

 

Works like a charm! Thank you for helping me. 

Could you maybe just explain to me what the end part of the concat does.

As A, A.Value

 

Kind regards

Ryan

v-xiaochen-msft
Community Support
Community Support

Hi @RyanVH ,

 

If the forall() function is nested in the forall() function, using the "ThisRecord.ColumnName" formula will not know which forall() function the parameter comes from.

 

So we could use As to rename it. Essentially A.Value = ThisRecord.Value.

If there is no ambiguity, it is not necessary to use As.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,930)