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

Onvisible Not Firing

I am trying to set the count value from DB rows and then render count no. of textboxes on screen. On Onvisible method wrote below code but it's not firing .

Set(count,CountA((Filter('[dbo].[TableName]',ID=selected.ID).Name)))

 

kindly suggest if any alternative are there.

 

Thanks,

Prajyot

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Onvisible Not Firing

Hi @prajyot,

Please make sure that you have fired the OnVisible property of the corresponding screen already. Please take a try to select other screen of your app, then back to the target screen (whose OnVisible property set to the formula you provided), check if the count variable is populated with values.

 

In addition, as an alternative solution, I think a Timer control could achieve your needs. Please consider take a try to add a Timer control within your target screen, set the Duration property to following:

1000

Set AutoStart property and Repeat property to following:

true

Set the OnTimerEnd property to following:

Set(count, CountA(Filter('[dbo].[TableName]',ID=selected.ID).Name))

Set the Visible property of the Timer control to following:

false

then check if the count variable is populated with proper value.

 

If the issue still exists, please consider take a try to re-create a new app based on your data source, then try your formula again, 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.
7 REPLIES 7
Super User
Super User

Re: Onvisible Not Firing

Your photo was a screenshot of your posting...not your problem.

 

Are you sure the statement is not being executed?  You have an extra set or parenthesis, but that should not be a problem. 

Are there other statements in your OnVisible action?  Any red X's?

 

I would go to another screen then come back to it (to make sure the OnVisible happens) and then look at your variables  (View->Variables-Global) and see if it is there.  If so, it is happening, perhaps just not returning what you think/expect. 

 

Hope this helps some.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Community Support Team
Community Support Team

Re: Onvisible Not Firing

Hi @prajyot,

Could you please share a bit more about the issue within your app (the screenshot you provided is not your issue)?

Do you mean that the count global variable could not store the count value which your CountA() formula returns?

Further, could you please share a bit more about the selected.ID that you mentioned?

The OnVisible property of a screen would only be fired when the corresponding screen is visible. Based on the formula that you mentioned, I could not find any syntax error with it.

Please consider take a try to add a Label control within your screen, then set the Text property to following:

CountA(Filter('[dbo].[TableName]',ID = selected.ID).Name)

then check if the Label control could display the count number. If the Label control could not display count number, I think this issue is related to your CountA() formula itself rather than OnVisible property.

 

Please check if you have typed proper filter condition within your Filter formula. In addition, please also consider take a try with the following formula:

CountRows(
Filter('[dbo].[TableName]', ID = selected.ID, Name <> Blank())
)

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.
prajyot
Level 8

Re: Onvisible Not Firing

Hello Kris ,

Thanks for your reply. I don't have any screenshot but I was not able to post the request without image (attachment) so I needed to attach the current scrrenshot only.

 

I had already tried by assigning the values to label.

Set(count,CountA((Filter('[dbo].[TableName]',ID=selected.ID).Name)))  --label.text = count - doesn't show correct results. However label.text =CountA((Filter('[dbo].[TableName]',ID=selected.ID).Name)))    works correctly.

Not sure while setting up the value to global variable there could be some delay.

 

Looks like setting global variable on OnVisible event is not  working.

 

Thanks & Regards,

Prajyot M 

Community Support Team
Community Support Team

Re: Onvisible Not Firing

Hi @prajyot,

Please make sure that you have fired the OnVisible property of the corresponding screen already. Please take a try to select other screen of your app, then back to the target screen (whose OnVisible property set to the formula you provided), check if the count variable is populated with values.

 

In addition, as an alternative solution, I think a Timer control could achieve your needs. Please consider take a try to add a Timer control within your target screen, set the Duration property to following:

1000

Set AutoStart property and Repeat property to following:

true

Set the OnTimerEnd property to following:

Set(count, CountA(Filter('[dbo].[TableName]',ID=selected.ID).Name))

Set the Visible property of the Timer control to following:

false

then check if the count variable is populated with proper value.

 

If the issue still exists, please consider take a try to re-create a new app based on your data source, then try your formula again, 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.
Highlighted
Super User
Super User

Re: Onvisible Not Firing

@prajyotso where is "selected.ID" coming from?  Is this actually having a value?  If not, then you will have an empty filter and thus a count that is not what you expect.

 

I would first check to see where you are getting the "selected" from.  I assume this is another variable.  If so, does it have a value OnVisible?

The fact that you have a label.text that shows a value and a Global Variable that is set OnVisible and doesn't have a value - and yet have the same formula, makes me wonder what you have in the selected variable..

 

To test - try to set the formula to a known ID (i.e. Set(count,CountA(Filter('[dbo].[TableName]',ID=10).Name)) and see if that returns at least a count of 1.  If so, then the selected.ID is the culprit to look at.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
prajyot
Level 8

Re: Onvisible Not Firing

The solution with Timer option did not work.

Super User
Super User

Re: Onvisible Not Firing

@v-xida-msft Kris! You're awesome! I was coming to the forum to report a bug: OnVisible not firing... Its already been reported and you've got a solution!

I arrived at the same solution although in my case, I have to set the timer duration to 1500ms for the OnVisible functions to fire. 1000ms was not enough. 
@MicrosoftPowerAppsTeam: Please consider this a bug that needs to be fixed. 
Thank you

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

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: 220 members 4,735 guests
Please welcome our newest community members: