cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Best Practice data source handling and other preset variables

Hello all,

 

My app is connected to 2 Sharepoint lists. The lists need to be updated quarterly, and shall not be overwritten due to compliance reasons. My question is, what is best practice to update the data sources to a different name (e.g. from FY19_Q3_Data to FY19_Q4_Data). Ideally, I would like to update the sources only in one place and not in multiple objects throughout the app. 

 

Related, I would also like to set some initial global variables (e.g. for colors) that don't need to be updated, but I thought it could follow a similar concept as handling the data source nomenclature.

 

What are your experiences and what approaches have worked best for you?

 

Thanks,

Tobias 

3 REPLIES 3
Super User III
Super User III

@Krau5i 

For your 1st question: I'm unclear about your situation with the SharePoint Lists.  To me it sounds like right now your app is connected to 2 SharePoint Lists and later you want your app to be connected to 2 completely different SharePoint Lists.  If this is your desire then I will say "do not try to do this."  PowerApps cannot store a datasource reference within a variable and therefore the code cannot simply be updated in one place.  You will have to update your code in all places manually which introduces the possibility of breakage.

 

To meet your compliance requirements requires some creativity.  If we cannot keep changing the SharePoint lists for a PowerApps then what do we do instead?  Simple, we create lists belonging only to the PowerApp whose name remains the same.  Then we use Microsoft Automate to schedule a export of the data from the App's datasource to the Compliance datasource on some regular schedule.  For help with building a Workflow you can check out the MS Automate Community https://powerusers.microsoft.com/t5/General-Power-Automate/bd-p/FlowForum.

 

As per your 2nd question: here's an idea of how you could set a global variable in your app's OnStart property.

 

Set(
    gbl,
    {
    \\Control Type 1
    ctrl1_Color: Black,
    ctrl1_FontSize: 16,
    ctrl1_Fill:  White,
    ctrl1_Border: 1,

    \\Control Type 2
    ctrl2_Color: Blue, 
    ctrl2_FontSize  10,
    ctrl2_Fill:  White,
    ctrl2_Border: 1,
    }
);

 

Calling the variable would work like this.

 

gbl.crtl2_Fill

 

Please note these are just my opinions and don't represent any "best practices."  They are just my way of doing things.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Super User
Super User

@Krau5i 

For Q1: you may be able to set a global variable using a DropDown to set the different data sources. However, I think these data sources would need to have the exact same schemas ie same column headings & same column types for this to work.

You could then select "FY19 Q3" from your drop down then OnChange = If( Dropdown1.Selected.Value = "FY19 Q3", Set(varData, 'FY19_Q3_Data'), etc.

 

This may work, don't know as I've never tried it. Agree with @mdevaney this wouldn't be 'best practice'. Best practice would be to just filter your quarterly data inside your app.

 

For Q2: have you looked at 'Components'? https://docs.microsoft.com/en-us/powerapps/developer/component-framework/component-framework-for-can.... This is a short video by Mr Dang about getting started with Components https://www.youtube.com/watch?v=-eX5_OE4Awo

 

I'm yet to start using Components in my apps but will be in the not to distant future because of their cross-app usability.

I think the automated update with Power Automate would be the right way to do it. I'm having a hard time to find relevant posts online though. If you have any leads to replace entire Sharepoint lists from an Excel file, it would be very appreciated.

 

Thanks,

Tobias 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (52,106)