cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shaneOZ
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
shaneOZ
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
v-yuxima-msft
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. 

shaneOZ
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

shaneOZ
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?

shaneOZ
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (47,140)