cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Patch items in a gallery to sharepoint

Hello, 

 

I am trying to fix my app that broke. I changed the column types in SharePoint to be text fields instead of number fields as the purpose of the app has changed. I understand changing the column types in SharePoint assisted in my app breaking but now I can't figure out the correct formula to patch the gallery items to SharePoint. I thought I could change out Value to Text but that didn't work. 

I have a gallery in a gallery that displays the indicators and the months for my teams to enter in the data. I currently have it set up that after each indicator they need to hit the save button but I would love that if they could just submit the whole gallery. But baby steps as I need to figure out how to submit the data back to SharePoint then refresh the gallery show the data shows after it is submitted. I have two formulas that are attached to the gallery and my gallery is currently being filtered. It was working up until I made the change for the columns in SharePoint. 

Below are the formulas that I am using. Any help would be great as I need to this get back up running ASAP. 

 

Formula 1: this is for the gallery. I would like the 999 to be changed to either a character or left blank so my team knows what month has already been entered and which have not.

Table({month: 1, monthval:Coalesce(Text(ThisItem.January),'999')}, {month: 2, monthval:Coalesce(Text(ThisItem.February),'999')}, {month: 3, monthval:Coalesce(Text(ThisItem.March),'999')}, {month: 4, monthval:Coalesce(Text(ThisItem.April),'999')}, {month: 5, monthval:Coalesce(Text(ThisItem.May),'999')}, {month: 6, monthval:Coalesce(Text(ThisItem.June),'999')}, {month: 7, monthval:Coalesce(Text(ThisItem.July),'999')}, {month: 8, monthval:Coalesce(Text(ThisItem.August),'999')}, {month: 9, monthval:Coalesce(Text(ThisItem.September),'999')}, {month: 10, monthval:Coalesce(Text(ThisItem.October),'999')}, {month: 11, monthval:Coalesce(Text(ThisItem.November),'999')}, {month: 12, monthval:Coalesce(Text(ThisItem.December),'999')})

 

Formula 2: To submit the data in the gallery (save button)

Patch('SRS Indicators 2020', LookUp('SRS Indicators 2020', ID=ThisItem.ID), {January: Value(LookUp(Gallery6_6.AllItems, month=1).TextInput1_6.Text), February: Value(LookUp(Gallery6_6.AllItems, month=2).TextInput1_6.Text), March: Value(LookUp(Gallery6_6.AllItems, month=3).TextInput1_6.Text), April: Value(LookUp(Gallery6_6.AllItems, month=4).TextInput1_6.Text), May: Value(LookUp(Gallery6_6.AllItems, month=5).TextInput1_6.Text), June: Value(LookUp(Gallery6_6.AllItems, month=6).TextInput1_6.Text), July: Value(LookUp(Gallery6_6.AllItems, month=7).TextInput1_6.Text), August: Value(LookUp(Gallery6_6.AllItems, month=8).TextInput1_6.Text), September: Value(LookUp(Gallery6_6.AllItems, month=9).TextInput1_6.Text), October: Value(LookUp(Gallery6_6.AllItems, month=10).TextInput1_6.Text), November: Value(LookUp(Gallery6_6.AllItems, month=11).TextInput1_6.Text), December: Value(LookUp(Gallery6_6.AllItems, month=12).TextInput1_6.Text)}); Patch(colSRS2020, LookUp(colSRS, ID=ThisItem.ID), {January: Value(LookUp(Gallery6_6.AllItems, month=1).TextInput1_6.Text), February: Value(LookUp(Gallery6_6.AllItems, month=2).TextInput1_6.Text), March: Value(LookUp(Gallery6_6.AllItems, month=3).TextInput1_6.Text), April: Value(LookUp(Gallery6_6.AllItems, month=4).TextInput1_6.Text), May: Value(LookUp(Gallery6_6.AllItems, month=5).TextInput1_6.Text), June: Value(LookUp(Gallery6_6.AllItems, month=6).TextInput1_6.Text), July: Value(LookUp(Gallery6_6.AllItems, month=7).TextInput1_6.Text), August: Value(LookUp(Gallery6_6.AllItems, month=8).TextInput1_6.Text), September: Value(LookUp(Gallery6_6.AllItems, month=9).TextInput1_6.Text), October: Value(LookUp(Gallery6_6.AllItems, month=10).TextInput1_6.Text), November: Value(LookUp(Gallery6_6.AllItems, month=11).TextInput1_6.Text), December: Value(LookUp(Gallery6_6.AllItems, month=12).TextInput1_6.Text)})

TIA

 

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Patch items in a gallery to sharepoint

Hi @jjasper ,

 

Do you mean you change the "January"/"February"/etc. Column type to Text from Number, right?

Could you please share the error message when you change out Value to Text?

 

Since the column is Text type, there is no need to convert the format of TextInput1_6.Text. Please try to remove all Value() function in the Update part code of Patch function.

For example:

Patch('SRS Indicators 2020', LookUp('SRS Indicators 2020', ID=ThisItem.ID), {January: LookUp(Gallery6_6.AllItems, month=1).TextInput1_6.Text)

Hope this helps.

sik

Highlighted
Helper II
Helper II

Re: Patch items in a gallery to sharepoint

Yes I did change the column type from Number to Text for the months (Jan, Feb etc.). Your solution fixed the errors in the app but it is still not saving to SharePoint. 

Highlighted
Community Support
Community Support

Re: Patch items in a gallery to sharepoint

Hi @jjasper ,

 

OK, I think we can debug this formula step by step. Please follow the steps:

1. create a Label in the main-gallery, and set the Text property as below to see if the LookUp formula can output any data

LookUp(Gallery6_6.AllItems, month=1).TextInput1_6.Text

 2. if the LookUp formula can output the text as expected, try to hardcode the Text into the Patch formula as below to see if the Patch function can work well

Patch('SRS Indicators 2020', LookUp('SRS Indicators 2020', ID=ThisItem.ID), {January: "Test Text"})

 

Sik

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,567)