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.

View solution in original post

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,995)