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

Invalid argument type when adding second function after patch

Hi everyone,

 

I wrote this function to save input in our SQL database (also without the ClearCollect):

 

ClearCollect(NewItem;
Patch('[dbo].[TD - Tasks]';Defaults('[dbo].[TD - Tasks]');{Active: 1; Department: lbl_department.Text; MachineName: lbl_machineName.Text; MachineNumber: lbl_machineNumber.Text; Reason: selectedReason; Remarks: txtRemarks.Text; User: User().FullName; timeStamp: Now(); 'Start time': DateTimeValue(lbl_starttime.Text); 'Stop time': DateTimeValue(lbl_stoptime.Text)}))

 

This function works perfect. 

 

When i add just the next function after it, suddenly it gaves me an error "Invalid argument type. Expecting number, text or boolean":

 

ClearCollect(NewItem;
Patch('[dbo].[TD - Tasks]';Defaults('[dbo].[TD - Tasks]');{Active: 1; Department: lbl_department.Text; MachineName: lbl_machineName.Text; MachineNumber: lbl_machineNumber.Text; Reason: selectedReason; Remarks: txtRemarks.Text; User: User().FullName; timeStamp: Now(); 'Start time': DateTimeValue(lbl_starttime.Text); 'Stop time': DateTimeValue(lbl_stoptime.Text)})) / Navigate(Scn_xxxx)

 

But when we have different function like this, it works perfectly again:

Set(selectedReason; "Failure") / Navigate(Scn_xxxx)

 

Does anyone know what we are doing wrong? Is it "patch" that does not  want to have a second function after it, is it some setting? ..

 

Thanks a lot!

 

1 ACCEPTED SOLUTION

Accepted Solutions
jbrit2020
Continued Contributor
Continued Contributor

Try using ; instead of / here: DateTimeValue(lbl_stoptime.Text)})) / Navigate(Scn_xxxx)

 

Unless you're in France...if you're in France I think you need to use ;;

View solution in original post

3 REPLIES 3
jbrit2020
Continued Contributor
Continued Contributor

Try using ; instead of / here: DateTimeValue(lbl_stoptime.Text)})) / Navigate(Scn_xxxx)

 

Unless you're in France...if you're in France I think you need to use ;;

ChocDecor
Frequent Visitor

Waauw, how easy 🙂 Thanks a lot!!!

Pstork1
Dual Super User
Dual Super User

What locale are you based in?  This looks like you have a problem with statement separators.  You are using '/', but it should probably be ';;'.  Look at the chaining operator in the following documentation.

Build global support into canvas apps - Power Apps | Microsoft Docs



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

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
Top Kudoed Authors
Users online (4,420)