cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Load the data card on Start

All,

I am an app that needs to to load sharepoint data on start. once data is loaded, I have a checkbox that filters the data.

The issue is that data does not load unless I select or unselect the checkbox. I have tried to use onStart but it seems it does not work.

To filter the data with the checkbox, I have defined two valriables and wrote the following filter.

UpdateContext ({filterBy:1})

UpdateContext ({filterBy:2})

Switch(filterBy,1, SortByColumns(Filter(ChkList_TaskList, Text(Created, DateTimeFormat.ShortDate) <> Text(Today(), DateTimeFormat.ShortDate) && IsBlank(ITSM_Ticket)),"ITSM_Ticket", Descending),2, SortByColumns(Filter(ChkList_TaskList, Text(Created, DateTimeFormat.ShortDate) <> Text(Today(), DateTimeFormat.ShortDate) && !IsBlank(ITSM_Ticket)),"ParentID", Descending))

How do I get the data to load when app is starting?  Any idea?

 

Thanks,

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Load the data card on Start

Thank you all who answered. Greatly appreciated. IT seems to work now.

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Load the data card on Start

@Anonymous you have supplied three different statements.  Can you describe where you have these statements (i.e. what actions, properties, etc)?

 

Are you stating that the UpdateContext statements are in your CheckBox actions?

Are you stating that the Switch statement is your Items property on your 'whatever'?

If so, then what have you put in your OnStart?

 

If this is the case, then you will need to put your default state UpdateContext statement in OnStart. HOWEVER - you cannot put an UpdateContext in the OnStart because it does not have a screen scope, it has an app scope.

 

Please clarify what you are doing/seeing.

 

_____________________________________________________________________________________
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.
Anonymous
Not applicable

Re: Load the data card on Start

Hi Randy,

Thanks for responding.  

Are you stating that the UpdateContext statements are in your CheckBox actions? " Yes.

" Are you stating that the Switch statement is your Items property of the data card?" Yes

 

I am new to PowerApps, I tried to put the Filter/switch in onStart property. since it did not work, I took it out and put it back on item property of datacard. 

 

So basically, what I am trying to do is when the app starts, I need to have the data loaded on the datacard.

once it is loaded, if a user select the checkbox, then the list that is loaded needs to be filtered.

 

Thanks in advance,

 

Super User
Super User

Re: Load the data card on Start

No problem.  It's easy to get terms confused when new to the PowerApps world.

So a couple points of clarification:

1) You mention DataCards and Lists - these two are two different things. 

Lists - So, I am going to assume you have a Gallery or other type of list control.  If this is the case, then you will be setting the Items property of the control to your Filter statement.  In fact you might consider changing that to simplify - more on that later.

DataCard- So I am going to assume you have an EditForm control in your app.  If so, then you will set the DataSource to your ChkList_TaskList list and your Item to whateverYourListIs.Selected

 

2) Where is the CheckBox control?  Is it part of the actual data or is it a separate control you intend to use to simply "filter" data?

 

2)

_____________________________________________________________________________________
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: Load the data card on Start

Hi @Anonymous,

Do you want to load the data when your app starts without checking or uncheck the Checkbox control within your app?
I have made a test on my side, please take a try with the following workaround:

Set the Items property of the data card to following:

Switch(
filterBy,
1,
SortByColumns(Filter(ChkList_TaskList, Text(Created, DateTimeFormat.ShortDate) <> Text(Today(), DateTimeFormat.ShortDate) && IsBlank(ITSM_Ticket)),"ITSM_Ticket", Descending),
2,
SortByColumns(Filter(ChkList_TaskList, Text(Created, DateTimeFormat.ShortDate) <> Text(Today(), DateTimeFormat.ShortDate) && !IsBlank(ITSM_Ticket)),"ParentID", Descending),
ChkList_TaskList /* <-- Type your data source here. When your app starts, all records of your ChklIst_TaskList would load */
)

Or

Switch(
       filterBy,
       1, 
       SortByColumns(Filter(ChkList_TaskList, Text(Created, DateTimeFormat.ShortDate) <> Text(Today(), DateTimeFormat.ShortDate) && IsBlank(ITSM_Ticket)),"ITSM_Ticket", Descending),
       2, 
       SortByColumns(Filter(ChkList_TaskList, Text(Created, DateTimeFormat.ShortDate) <> Text(Today(), DateTimeFormat.ShortDate) && !IsBlank(ITSM_Ticket)),"ParentID", Descending),
       Filter(ChkList_TaskList, Text(Created, DateTimeFormat.ShortDate) <> Text(Today(), DateTimeFormat.ShortDate))  /* <-- Filter your ChkList_TaskList data source by current date */
)

Set the OnCheck property of the Check Box to following:

UpdateContext ({filterBy:1})

Set the OnUnCheck property of the Check Box to following:

UpdateContext ({filterBy:2})

 

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.
Anonymous
Not applicable

Re: Load the data card on Start

Thank you all who answered. Greatly appreciated. IT seems to work now.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,395)