cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Changal
Helper II
Helper II

Can we restrict the fields in PowerApps based on collection or group

Here we have two different SharePoint lists belongs to same site. In one SharePoint Site I have all the field names. And another list contains all the fields same as first list along with that step numbers (Refer KSS1). Here we have 5 different teams, and each team have 74 steps of Approvals. Based on the step the flow is in fields  displaymode to be edit or disabled.

1 ACCEPTED SOLUTION

Accepted Solutions
rubin_boer
Super User
Super User

hi @Changal the short answer is yes you can restrict by group or collection.

 

I will share a way of doing it as I am sure there are many ways.

 

Objective

Set control to edit or visible based on the workflow step

Method

build a collection that will act, as a rule, to determine when a control must be edited or disabled.

 

Steps

  1. Create a gallery with 74 items to act as the steps: Formula  Sequence(74)

rubin_boer_0-1670402187402.png

 

  1. Create a local variable when the workflow step is achieved: Formula UpdateContext({wfStep: ThisItem.Value})

On the OnSelect Property

rubin_boer_1-1670402311659.png

 

  1. Create a collection to host the rules: collection colRules:

id: unique identifier

type: type of rule 0, smaller than, 1 equals a value

eval: the criteria to determine whether it will be editable else disabled

(e.g., id: 0,  type: 0, eval: [50] states if the wf is smaller than 50)

ClearCollect(colRules, 
    {id: 0, type: 0, eval: [50]}, // 0 = smaller
    {id: 1, type: 1, eval: [20]}, // 1 = equals
    {id: 3, type: 2, eval: [15, 16, 20, 23, 34]},  // 2 = in
    {id: 4, type: 3, eval: [15, 16, 20, 23, 34]},  // 3 = not in
    {id: 5, type: 4, eval: [15, 16]}  // 4 =  between    
)

 

Set the edit and disable mode

Define the rule 

_type as defined in colRules

_rulex as you need them

With(
    {
        _rule0: Index(Index(colRules, 1).eval, 1).Value,
        _rule1: Index(Index(colRules, 2).eval, 1).Value,
        _rule2: Index(colRules, 3).eval,
        _type: 0 //select your rule
    },
    Switch(
        true, 
        _type = 0,  If(SomeGallery.Selected.Value < _rule0, DisplayMode.Edit, DisplayMode.Disabled),
        _type = 1,  If(SomeGallery.Selected.Value = _rule1, DisplayMode.Edit, DisplayMode.Disabled),
        _type = 2,  If(SomeGallery.Selected.Value in _rule2, DisplayMode.Edit, DisplayMode.Disabled)
    )
)

 

Result

rules.gif

Hope it helps

hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

View solution in original post

2 REPLIES 2
rubin_boer
Super User
Super User

hi @Changal the short answer is yes you can restrict by group or collection.

 

I will share a way of doing it as I am sure there are many ways.

 

Objective

Set control to edit or visible based on the workflow step

Method

build a collection that will act, as a rule, to determine when a control must be edited or disabled.

 

Steps

  1. Create a gallery with 74 items to act as the steps: Formula  Sequence(74)

rubin_boer_0-1670402187402.png

 

  1. Create a local variable when the workflow step is achieved: Formula UpdateContext({wfStep: ThisItem.Value})

On the OnSelect Property

rubin_boer_1-1670402311659.png

 

  1. Create a collection to host the rules: collection colRules:

id: unique identifier

type: type of rule 0, smaller than, 1 equals a value

eval: the criteria to determine whether it will be editable else disabled

(e.g., id: 0,  type: 0, eval: [50] states if the wf is smaller than 50)

ClearCollect(colRules, 
    {id: 0, type: 0, eval: [50]}, // 0 = smaller
    {id: 1, type: 1, eval: [20]}, // 1 = equals
    {id: 3, type: 2, eval: [15, 16, 20, 23, 34]},  // 2 = in
    {id: 4, type: 3, eval: [15, 16, 20, 23, 34]},  // 3 = not in
    {id: 5, type: 4, eval: [15, 16]}  // 4 =  between    
)

 

Set the edit and disable mode

Define the rule 

_type as defined in colRules

_rulex as you need them

With(
    {
        _rule0: Index(Index(colRules, 1).eval, 1).Value,
        _rule1: Index(Index(colRules, 2).eval, 1).Value,
        _rule2: Index(colRules, 3).eval,
        _type: 0 //select your rule
    },
    Switch(
        true, 
        _type = 0,  If(SomeGallery.Selected.Value < _rule0, DisplayMode.Edit, DisplayMode.Disabled),
        _type = 1,  If(SomeGallery.Selected.Value = _rule1, DisplayMode.Edit, DisplayMode.Disabled),
        _type = 2,  If(SomeGallery.Selected.Value in _rule2, DisplayMode.Edit, DisplayMode.Disabled)
    )
)

 

Result

rules.gif

Hope it helps

hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

Hi @rubin_boer ,

 

 Thank you so much. It really working. 

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.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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 (2,461)