web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Define a standard chec...
Power Apps
Answered

Define a standard checkbox depending on a variable with options of various values

(0) ShareShare
ReportReport
Posted on by

I have a list in SharePoint with a field where I have two checkboxes, as below:

 

checkboxes.png

 

And I have a variable called; "varMode", where it depends when the user creates a new form it is activated as "New" which will be activated a new form...

 

Like this Image:

default_1.png

 

So, what I need is when the "New" variable is activated, the checkbox will be activated and will save the text in it, I tried to put the code in the image above, but it is not activated and I would like some help with how to activate it and save the text.

 

The code:

 

If(
 varMode = "New";
 CheckboxCustosEdit_2.Text in ThisItem.CustosEstimadosOpcao.Value&&true;
 CheckboxCustosEdit_2.Text in ThisItem.CustosEstimadosOpcao.Value
)

 

And the code on "Update" in the card: 

 

ForAll(
 Split(
 Concatenate(
 If(
 CheckboxCustosEdit_2.Value;
 CheckboxCustosEdit_2.Text & ",";
 ""
 );
 If(
 CheckBoxEditNo_7.Value;
 CheckBoxEditNo_7.Text & ",";
 ""
 )
 );
 ","
 );
 {Value: Result}
)

 

Thank's for your time! : D

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Gorilla_8 :

    Firstly,could you confirm that when the user creates a new form, the value of varMode will become ‘true’?

    Usually we don't use form mode to determine whether the user is creating a new form. Because in the custom form, regardless of whether the user is creating or editing, the form mode remains unchanged.I suggest you use this formula to determine whether the user is creating a new item:

    IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected)

    Secondly,I think this if() formula has a small problem in logic:

    The point is the value of 

    CheckboxCustosEdit_2.Text in ThisItem.CustosEstimadosOpcao.Value&&true

    and the value of 

    CheckboxCustosEdit_2.Text in ThisItem.CustosEstimadosOpcao.Value

    will be the same anyway.Because '&&' means 'And'.The logical AND (&&) operator (logical conjunction) for a set of operands is true if and only if all of its operands are true. So ‘&& true’ has no meaning.

    Maybe you could try:

    CheckboxCustosEdit_2.Text in ThisItem.CustosEstimadosOpcao.Value || true

    Best Regards,

    Bof

     

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Gorilla_8 :

    Is the problem solved?

    What else can I do for you?

    Best Regards,

    Bof

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 490

#2
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 381

Last 30 days Overall leaderboard