cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
shaneOZ
Level 8

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 Smiley Happy 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
shaneOZ
Level 8

Re: If no collection item in gallery is selected send blank

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

 

 

{PitButt: "", IsClicked:false}

 

 

 

6 REPLIES 6
Community Support Team
Community Support Team

Re: If no collection item in gallery is selected send blank

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

Administrator
Administrator

Re: If no collection item in gallery is selected send blank

Hi @shaneOZ how are you progressing with this?

 

@TopShelf-MSFT 

shaneOZ
Level 8

Re: If no collection item in gallery is selected send blank


@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. 

shaneOZ
Level 8

Re: If no collection item in gallery is selected send blank


@TopShelf-MSFT wrote:

Hi @shaneOZ how are you progressing with this?

 

@TopShelf-MSFT 


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

shaneOZ
Level 8

Re: If no collection item in gallery is selected send blank

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?

shaneOZ
Level 8

Re: If no collection item in gallery is selected send blank

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

 

 

{PitButt: "", IsClicked:false}

 

 

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 152 members 4,298 guests
Please welcome our newest community members: