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
Anonymous
Not applicable

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

Anonymous
Not applicable

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. 

 

          

Anonymous
Not applicable

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))

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 ;

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 ... @Anonymous @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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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,499)