cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Responsive Resident
Responsive Resident

If no collection item in gallery is selected send blank

Hi,

 

I have a gallery that loads its values from a collection to patch into a choice column in sharepoint, i would like if the user does not select a button in that gallery then the patch function is to send Null or Blank, it currently sends the first item in the collection

 

My on start syntax is 

ClearCollect(
      PitList,
  {PitButt: "LM1", IsClicked:false},
  {PitButt: "LM2", IsClicked:false},
  {PitButt: "LM3", IsClicked:false},
  {PitButt: "SR1", IsClicked:false},
  {PitButt: "SR2", IsClicked:false},
  {PitButt: "SRE", IsClicked:false}
);
Set(CurrentPitButt, Blank());

My buttons on select is 

If(
    CurrentPitButt = ThisItem.PitButt || CurrentPitButt = Blank(),
    Set(CurrentPitButt, ThisItem.PitButt);Patch(PitList, ThisItem, {IsClicked: !ThisItem.IsClicked}),
    Set(CurrentPitButt, ThisItem.PitButt);UpdateIf(PitList, true, {IsClicked:false});Patch(PitList, ThisItem, {IsClicked: !ThisItem.IsClicked})
)

Any help would be appreciated. 

 

Thankyou 🙂 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Responsive Resident
Responsive Resident

Ignore i just mark the default as, Duh..  Smiley Very Happy

 

 

{PitButt: "", IsClicked:false}

 

 

 

View solution in original post

6 REPLIES 6
Community Support
Community Support

Hi @shaneOZ 

 

Could you please share more details of your SP list

PitButt is the choice column type in your SP list?You want to patch the value from the gallery if you select to SP list?

And could you please share more details of your gallery?

In the gallery there buttons or what?

 

Best Regards.

Yumia

Anonymous
Not applicable

Hi @shaneOZ how are you progressing with this?

 

@Anonymous 


@v-yuxima-msft wrote:

Hi @shaneOZ 

 

Could you please share more details of your SP list

PitButt is the choice column type in your SP list?You want to patch the value from the gallery if you select to SP list?

And could you please share more details of your gallery?

In the gallery there buttons or what?

 

Best Regards.

Yumia


Sorry for the late reply,

 

The project was put on hold and i was off playing with powerBi however i now need to solve this one,

 

PitButt is just the collection name, the column it references in sharepoint is simply called Pit it is a choice column and is patched via the following code,

If(Connection.Connected
	,Patch('Haulage Log',
		Defaults('Haulage Log'),
		{
            Pit: {Value: PitGallery.Selected.PitButt}		
		}
	)
	,Collect(HAULAGECOLLECTION,
		{
		 Asset: Can_Assetid.Selected,
            Pit: {Value: PitGallery.Selected.PitButt}	
		}
	)
)

it patches succesfully. However if the user doesnt select the pit (which happens) it sends the first  value "LM1" in the collection and i would like it too send nothing if unselected. 

Responsive Resident
Responsive Resident


@Anonymous wrote:

Hi @shaneOZ how are you progressing with this?

 

@Anonymous 


Sorry for the late reply and thankyou for your interest, see above

Responsive Resident
Responsive Resident

I should also say ive tried using the 

ClearCollect(
      PitList,
  {PitButt: "", IsClicked:false},
  {PitButt: "LM1", IsClicked:false},
  {PitButt: "LM2", IsClicked:false},
  {PitButt: "LM3", IsClicked:false},
  {PitButt: "SR1", IsClicked:false},
  {PitButt: "SR2", IsClicked:false},
  {PitButt: "SRE", IsClicked:false}
);
Set(CurrentPitButt, Blank());

However i do not want to have a empty button in the app, can i hide the button somehow?

Responsive Resident
Responsive Resident

Ignore i just mark the default as, Duh..  Smiley Very Happy

 

 

{PitButt: "", IsClicked:false}

 

 

 

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (7,143)