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

Everything After Patch is Considered a Boolean

In trying to build an inventory check in and check out app.

 

I have the gallery built, but having issues with the check out screen.

I have moved the patch to the on success property of the page. I think that is a better flow. But I still would like to know what is going on with this code for future development. Everything after the Patch that is commented out shows as boolean and errors out. I can comment it out like it is and it be just fine error wise.

 

The idea for the flow is to select the item that needs to be checked out on the gallery page. fill out some info about who is checking it out. Then click a button that would check the info on the NFC Tag attached to that item to verify then submit the form and Patch the check out status to after that. I would like to avoid the user from selecting the check out status and change it in the code. I have an Excel data source.

 

 

With(
    ReadNFC(),
    If(
        !IsBlank(Text),
        If(
            DataCardValue21.Text = Text,
            SubmitForm(EditForm1),
            Notify("Incorrect Serial Number Confirmation Contact ",NotificationType.Warning, 5000)
        ),
        Notify("NFC Tag Blank Contact ")
    );
       
    If(
        !IsBlank(Text),
        If(
            DataCardValue21.Text = Text,
            Patch(Table1,ListMonitorInfo.Selected,{IsCheckedOut: "True"})//,
            //Notify("Incorrect Serial Number Confirmation Contact ",NotificationType.Warning, 5000)
        //),
        //Notify("NFC Tag Blank Contact ")
    )
);
Navigate(BrowseScreen1)

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Alex_10
Super User
Super User

@nmhammer2 

I could replicate your situation with a SP list as datasource. So Excel is not the reason.

 

to fix it, I added Set() to Patch:

 

With(ReadNFC(),
    If(!IsBlank(Text),
      If(DataCardValue21.Text = Text,
          SubmitForm(EditForm1),
          Notify("Incorrect Serial Number Confirmation Contact ",NotificationType.Warning, 5000)
      ),
    Notify("NFC Tag Blank Contact ")
);
If(!IsBlank(Text),
    If(DataCardValue21.Text = Text,
      Set(varPatchResponse, Patch(Table1,ListMonitorInfo.Selected,{IsCheckedOut: "True"})),
      Notify("Incorrect Serial Number Confirmation Contact ",NotificationType.Warning, 5000)
    ),
    Notify("NFC Tag Blank Contact ")
)
);
Navigate(BrowseScreen1)

 

 

It looks like if app does not store Patch's response in a variable, Patch() is recognized as a boolean by the app (which causes the error with your code).

If i add an action after Patch, that action resolves the issue as well:

Patch(Table1,ListMonitorInfo.Selected,{IsCheckedOut: "True"}); Set(varDummyVar, Blank())

OR

Patch(Table1,ListMonitorInfo.Selected,{IsCheckedOut: "True"}); Navigate(BrowseScreen1)

 

View solution in original post

7 REPLIES 7
Alex_10
Super User
Super User

@nmhammer2 

 

what is the reason of having duplicating If statements in a single action?

can you share a screenshot of the error and its text?

 

 

With( ReadNFC(),
    If( !IsBlank(Text),
        If(DataCardValue21.Text = Text,
            SubmitForm(EditForm1);
            Patch(Table1, ListMonitorInfo.Selected, {IsCheckedOut: "True"});
            ,
            Notify("Incorrect Serial Number Confirmation Contact ",NotificationType.Warning, 5000)
        )
        ,
        Notify("NFC Tag Blank Contact ")
    );
);

Navigate(BrowseScreen1);

 

nmhammer2_0-1624988518252.png

nmhammer2_2-1624989210894.png

 

Since the check out status is being change by code, I wanted to use submitform to handle errors regarding text input and the data source first. I then changed the record of the selected items IsCheckedOut field via patch. I could not get it to all work in the if statement's true action, so I duplicated the if statement and kept the NFC Tag check to make sure that check was still in place.

Alex_10
Super User
Super User

@nmhammer2 

what is the datatype for IsCheckedOut column? is it a string(text) or a choice?

 

The only idea i have is replacing patch code with:

Patch(Table1, ListMonitorInfo.Selected, {IsCheckedOut: {Value: true} })

 

If that is not the case, i dont know what can cause it.

 

Powerapps is using it as a Text field. (I wish I could get to boolean)

Alex_10
Super User
Super User

@nmhammer2 

on your screenshot there 2 parts that look like a double red bold underline.

if you hover over Notify("NFC Tag Blank Contact "), does it show more errors in the popup?

and if hover over If(

If I hover over the if statements it just says "the function if has invalid arguments" then the double read line reads the previous message and "Invalid argument type (boolean) expecting record value instead.

Alex_10
Super User
Super User

@nmhammer2 

I could replicate your situation with a SP list as datasource. So Excel is not the reason.

 

to fix it, I added Set() to Patch:

 

With(ReadNFC(),
    If(!IsBlank(Text),
      If(DataCardValue21.Text = Text,
          SubmitForm(EditForm1),
          Notify("Incorrect Serial Number Confirmation Contact ",NotificationType.Warning, 5000)
      ),
    Notify("NFC Tag Blank Contact ")
);
If(!IsBlank(Text),
    If(DataCardValue21.Text = Text,
      Set(varPatchResponse, Patch(Table1,ListMonitorInfo.Selected,{IsCheckedOut: "True"})),
      Notify("Incorrect Serial Number Confirmation Contact ",NotificationType.Warning, 5000)
    ),
    Notify("NFC Tag Blank Contact ")
)
);
Navigate(BrowseScreen1)

 

 

It looks like if app does not store Patch's response in a variable, Patch() is recognized as a boolean by the app (which causes the error with your code).

If i add an action after Patch, that action resolves the issue as well:

Patch(Table1,ListMonitorInfo.Selected,{IsCheckedOut: "True"}); Set(varDummyVar, Blank())

OR

Patch(Table1,ListMonitorInfo.Selected,{IsCheckedOut: "True"}); Navigate(BrowseScreen1)

 

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.

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 (4,284)