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

Trouble with OnSelect Firing on First Select in Gallery

Hello,

 

I have an app with a gallery that i'm trying to reset several forms with actions on the select. I'm working between the Onselect of the gallery and an OnSelect of an icon inside the gallery but can't seem to get it to fire the reset on the first click. If I click the same item again, it will reset the form.

 

On the first click, the form is still showing the data from the last click on a different item.

 

Please let me know if you have any questions to help clarify.

 

Thank you.

9 REPLIES 9
Super User
Super User

Re: Trouble with OnSelect Firing on First Select in Gallery

@DTreg1
I’d like to request further information about your issue:

1. Can you please share any code related to the OnSelect property of your gallery and also the icon

2. Can you please share any code related to the Reset property for any form your are trying to reset?

3. Can you please share any code related to the Default property of any form fields you are trying to reset?
DTreg1
Level 8

Re: Trouble with OnSelect Firing on First Select in Gallery


@mdevaney wrote:
@DTreg1
I’d like to request further information about your issue:

1. Can you please share any code related to the OnSelect property of your gallery and also the icon
     Currently, this is actually the OnSelect of an arrow icon within the gallery. The OnSelect property of the Gallery is blank. I've tried switching this but it still didn't help.
Concurrent(
    ResetForm(PSEJForm),
    ResetForm(PipingForm),
    ResetForm(ValvesForm),
    ResetForm(GasketsForm),
    ResetForm(BoltStudsForm),
    ResetForm(SmallPipingForm),
    ResetForm(SealWeldingForm),
    ResetForm(InsulatedLineForm),
    ResetForm(AlloyLinesForm),
    ResetForm(MiscellaneousForm)
);
If(
    !(ThisItem.PKG_ID in '[database].[table]'.PKG),
    NewForm(GenInfoForm),
    ViewForm(GenInfoForm)
);
UpdateContext({GenInfo: true});
UpdateContext({Header: true})
2. Can you please share any code related to the Reset property for any form your are trying to reset?
I don't have anything on the "OnReset" of the form, I just have the radio button Reset: true. The default property of the radio button is
If(IsBlank(PSEJ1),AllPSEJ,If(PSEJ1="N/A","N/A","Accept"))
"AllPSEJ" is a context for a select all checkbox option

3. Can you please share any code related to the Default property of any form fields you are trying to reset?
The default mode of the form is Edit.


Please let me know if you have any other questions, I appreciate the help @mdevaney .

 

Thank you

Super User
Super User

Re: Trouble with OnSelect Firing on First Select in Gallery

@DTreg1 

Wow, that's alot of forms!  Thank you for the detailed response.  I thought seeing some of the code would help me understand what you are trying to accomplish but I must admit I'm unsure.

 

Maybe the next step would be to send some screen shots.  Would you be able capture (1) what is being clicked, (2) what the improper behaviour looks like and (3) what the good behaviour looks like?

DTreg1
Level 8

Re: Trouble with OnSelect Firing on First Select in Gallery

@mdevaney ,

 

Yeah..I found that breaking it out helped keep performance up rather than having everything all in one. I'll work on getting some screenshots.

 

Thank you

Super User
Super User

Re: Trouble with OnSelect Firing on First Select in Gallery

@DTreg1
I’m reviewing about your code in the button and this is the code I want to test first. It could possible your IF statement trigger is the cause of the malfunction. My theory is when clicked the 1st time it evaluates to False and the 2nd time it evaluates to True.

If(
    !(ThisItem.PKG_ID in '[database].[table]'.PKG),
    NewForm(GenInfoForm),
    ViewForm(GenInfoForm)
);


Could you try putting this code in your gallery in a label temporarily? It will either show True of False. What does it show before you click? After the 1st click? After the 2nd click?

!(ThisItem.PKG_ID in '[database].[table]'.PKG)
Super User
Super User

Re: Trouble with OnSelect Firing on First Select in Gallery

@DTreg1 , have you tried changing the order in which you reset the form and change form mode? Try doing the form mode change first.

 

Example:

If(
    !(ThisItem.PKG_ID in '[database].[table]'.PKG),
    NewForm(GenInfoForm),
    ViewForm(GenInfoForm)
);
Concurrent(
    ResetForm(PSEJForm),
    ResetForm(PipingForm),
    ResetForm(ValvesForm),
    ResetForm(GasketsForm),
    ResetForm(BoltStudsForm),
    ResetForm(SmallPipingForm),
    ResetForm(SealWeldingForm),
    ResetForm(InsulatedLineForm),
    ResetForm(AlloyLinesForm),
    ResetForm(MiscellaneousForm)
);
UpdateContext({GenInfo: true});
UpdateContext({Header: true})


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: Trouble with OnSelect Firing on First Select in Gallery

Hi @DTreg1 ,

Could you please share a bit more about your scenario?

Do you mean that you could not reset your Edit forms when you first click the Item in your Gallery?

 

I have made a test on my side, and don't have the issue that you mentioned. Please consider modify your formula as below:

 

Concurrent(
    ResetForm(PSEJForm);EditForm(PSEJForm),
    ResetForm(PipingForm);EditForm(PipingForm),
    ResetForm(ValvesForm);EditForm(ValvesForm),
    ResetForm(GasketsForm);EditForm(GasketsForm),
    ResetForm(BoltStudsForm);EditForm(BoltStudsForm),
    ResetForm(SmallPipingForm);EditForm(SmallPipingForm),
    ResetForm(SealWeldingForm);EditForm(SealWeldingForm),
    ResetForm(InsulatedLineForm);EditForm(InsulatedLineForm),
    ResetForm(AlloyLinesForm);EditForm(AlloyLinesForm),
    ResetForm(MiscellaneousForm);EditForm(MiscellaneousForm)
);
If(
    !(ThisItem.PKG_ID in '[database].[table]'.PKG),
    NewForm(GenInfoForm),
    ViewForm(GenInfoForm)
);
UpdateContext({GenInfo: true});
UpdateContext({Header: true})

 

Or set the OnSelect property of the ">" icon to following:

Select(Parent);    /* <-- Add this formula */
If( !(ThisItem.PKG_ID in '[database].[table]'.PKG), NewForm(GenInfoForm), ViewForm(GenInfoForm) ); UpdateContext({GenInfo: true}); UpdateContext({Header: true})

Set the OnSelect property of the Gallery to following:

Concurrent(
    ResetForm(PSEJForm),
    ResetForm(PipingForm),
    ResetForm(ValvesForm),
    ResetForm(GasketsForm),
    ResetForm(BoltStudsForm),
    ResetForm(SmallPipingForm),
    ResetForm(SealWeldingForm),
    ResetForm(InsulatedLineForm),
    ResetForm(AlloyLinesForm),
    ResetForm(MiscellaneousForm)
);

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
DTreg1
Level 8

Re: Trouble with OnSelect Firing on First Select in Gallery

Hi @v-xida-msft 

 

Thank you for the suggestions, I've tried both and still seem to have previous record data showing up in the form after selecting a new item. Sometimes after one click on the Completed item then one click on the In Process item, sometimes not. Sometimes after to clicks of the Completed, but on the second click on the In Process item, it always clears it. I noticed that some of the labels inside the gallery template had Select(Parent) on them so I went ahead and remove that from those and made sure the icon was brought to the front but it's still happening...

 

There must be some underlying formula I have somewhere that might be contributing to it...I may just need to rebuild, oh well, good practice and I bet I can implement some other newer features anyways, this one was getting a little outdated.

 

Thanks again for everyones help. After I rebuild, i'll reply back if I was able to identify what I believe the cause was.

DTreg1
Level 8

Re: Trouble with OnSelect Firing on First Select in Gallery

@Jeff_Thorpe 

 

Yeah that was actually my original sequence, I tried moving it up thinking I needed to reset first but still no luck.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,070)