cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mayur2
Frequent Visitor

Breaking from ForAll loop or using set inside ForAll

Hi all,

I am using a list in my app which contains email Ids of Admins (HealthManager in my case).

When User opens the the apps I want to check whether he is Admin or not. Earlier I was using flow. But now I need to remove flow from it.

So i have created a collection of that list in App onStart. Below is my code: 

 

ClearCollect(HealthManager, HealthManagerList);
Set(HealthMgr,ForAll(HealthManager,If(Upper(User().Email) in Upper(HealthManager.Email),"True")));
Set(isHealthMgr, HealthMgr);

 

the problem i am facing is HealthMgr variable is of 'table' type not Boolean.

I want my HealthMgr/isHealthMgr to be of boolean so that rest of functionality on other screen works fine.

So is there a way to break from forall loop so that i dont have table of trues&false but just one true/false

1 ACCEPTED SOLUTION

Accepted Solutions
pontusofsweden
Resolver IV
Resolver IV

Hi @mayur2!

 

You dont need a ForAll loop to accomplish this. Try this formula for setting the variable instead: Set(HealthMgr,If(CountIf(HealthManager,Email = User().Email) > 0,true,false)). 

 

Also, now you are trying to save the variable as a text, but by removing the quote marks, you will get boolean values instead.

 

BR

Pontus

 

View solution in original post

1 REPLY 1
pontusofsweden
Resolver IV
Resolver IV

Hi @mayur2!

 

You dont need a ForAll loop to accomplish this. Try this formula for setting the variable instead: Set(HealthMgr,If(CountIf(HealthManager,Email = User().Email) > 0,true,false)). 

 

Also, now you are trying to save the variable as a text, but by removing the quote marks, you will get boolean values instead.

 

BR

Pontus

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (39,133)