cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shahin1
Helper I
Helper I

Patch to append to excel file and Isempty function

Hi I want to append these below details to excel everytime a new user enters the data

Excel Table which is linked with onedrive is Table1
Columns:
Name/CurrentDate/Required_date/Choice(Drop-down)/Cost/Toggle

Name is column with textInput user name
CurrentDate is today's date
Required date is the date going to be selected by user
Choice is having dropdow
Cost is a value
Toggle is yes/no

I am trying to use patch function for submit button but I am getting syntax errors..
Also it should get submitted only when all the columns are filled else it should not get navigated to next screen.

Can someone help me with the solution.
Thankyou.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
dos757
Resolver I
Resolver I

I assume that the currentDate is setted already with today and i don't have the control names so try something like this.

 

If(!IsBlank(NameControl.Text) And !IsBlank(RequiredDatePicker.SelectedDate) And !IsBlank(ChoiceControl.selected.Text) And !IsBlank(Value(CostControl.Text)) And !IsBlank(Toggle.Value),
Patch(Table1,
defaults(Table1),
{
Name : NameControl.Text,
CurrentDate : Today(),
RequiredDate : RequiredDatePicker.SelectedDate,
Choice : ChoiceControl.selected.Text,
Cost : CostControl.Text,
boolColumn : Toggle.Value
}),,
Navigate(Page 2),Notify("You must fill-in all fields", NotifyType.Error))

View solution in original post

CNT
Super User
Super User

@Shahin1 At the end of the Patch - before Navigate(.....) you are having 2 commas. Replace that with a semicolon ;

View solution in original post

12 REPLIES 12
CNT
Super User
Super User

@Shahin1 Could you share a few screens and formulas

dos757
Resolver I
Resolver I

If(!IsEmpty(field1) And !IsEmpty(field2).....; 

Patch(ExcelTable; Defaults(ExcelTable); {Column 1 : Field 1; Colum 2 : Field 2; ......});;Navigate(Page2); Notify("You must fill-in all field"; NotifyType.Error)

 

I assume you're in US format so ";" are replaced with ",". I'm using French format. 

 

          

dos757
Resolver I
Resolver I

I assume that the currentDate is setted already with today and i don't have the control names so try something like this.

 

If(!IsBlank(NameControl.Text) And !IsBlank(RequiredDatePicker.SelectedDate) And !IsBlank(ChoiceControl.selected.Text) And !IsBlank(Value(CostControl.Text)) And !IsBlank(Toggle.Value),
Patch(Table1,
defaults(Table1),
{
Name : NameControl.Text,
CurrentDate : Today(),
RequiredDate : RequiredDatePicker.SelectedDate,
Choice : ChoiceControl.selected.Text,
Cost : CostControl.Text,
boolColumn : Toggle.Value
}),,
Navigate(Page 2),Notify("You must fill-in all fields", NotifyType.Error))

View solution in original post

It worked if write only till navigate(screen) ... It's throwing error if I write notify as above.. Notify is not working ...

CNT
Super User
Super User

@Shahin1 At the end of the Patch - before Navigate(.....) you are having 2 commas. Replace that with a semicolon ;

View solution in original post

I replaced it with single comma it worked

@Shahin1 Glad you got it right!

Shahin1
Helper I
Helper I

But It's not reflecting in excel sheet?

Hi ... @dos757 @CNT 

Thanks for your formula..

But Data is not getting reflected in Excel sheet ... Excel sheet is not opened .. it's closed .. but still the data is not reflecting in excel sheet ... What might be the error?

 

And also when I fill all fields and submit .. it's navigating to next screen but screen1 is showing the previous details of which I entered ...( If new user wants to enter the details it shouldnot show previous user details ).. 

 

Do I have to change any settings in properties? Can you help me with this..

Thankyou..

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,012)