cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jimmydebie
Regular Visitor

Reference a column value from variable to show/hide button "Invalid argument type"

I created a powerapps with a data connection to a SP list.

As the list contains many columns, I have multiple screens, each showing a part of the list in a form.

I'm saving the form to SP on each screen but a “draft mode” status can be added (Column in SP list called FormStatus choice between Draft, Submitted, default = Draft), so that although it has been created in SharePoint, with it being in draft, this indicates that it’s not finished and not officially submitted yet.

Each screen= varListItem -> stores the whole record of the current item

 

On the last screen, I want to be able to Submit the form. I have 3 buttons, visibility depends on the FormStatus value.

Tryin to achieve this via: 

Visible: varListItem.'FormStatus'="Draft"

 

Keep getting the red circle/white cross "Invalid argument type".

Can someone help with syntax here?

 

Thanks in advance!

Jimmy

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@jimmydebie 

What kind of column is FormStatus?  If it is a choice column, then you need to use the following for your formula:

varListItem.FormStatus.Value="Draft"

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@jimmydebie 

What kind of column is FormStatus?  If it is a choice column, then you need to use the following for your formula:

varListItem.FormStatus.Value="Draft"

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
HarjitSamra
Advocate II
Advocate II

As visible is a Property you'd need:

 

Visible: If(varListItem.'FormStatus'="Draft", false, true)


(or vice versa)

@HarjitSamra 

Just and FYI on your formula, you can save yourself some time by not adding all the "If" "true" false" stuff.

When you put a condition such as something=something in your formula, it will already evaluate to true or false, so there is no need to put in an if statement to see if something is true so that you can then return true...it is already true (or false).

Just be aware of parenthesis are sometimes needed.  For example, if you wanted the ! (not) condition of the above, then using !something=something will usually give you an error because PowerApps is trying to "not" the first something...which is usually not valid.  So, your formula would become !(something=something)

This way PowerApps then is forced into the order of precedence that you want.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hey @RandyHayes , thanks for the tip - I didn't know that.

 

Personally I would spend the few seconds typing the If statement so as to help the 'Future me' - when I come back to the code and try to understand it in a few months 🙂

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,292)