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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

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.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,879)