web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / TemplateFill refresh i...
Power Apps
Unanswered

TemplateFill refresh in gallery

(1) ShareShare
ReportReport
Posted on by 6

Hi,

My data model consists of a main table and a lot of related tables (with foreign keys to the main one). I try to highlight the fact that the user already filled a sub table or not. To this purpose I used the TemplateFill property of my gallery with a LookUp testing if the data object is blank or not.

If(IsBlank(LookUp(DataSourceTable,GniID=galInspections.Selected.gni_id)),White,GreenYellow)

 

It works fine on first loading (Bleeder table not yet filled in in this screenshot) but when I try to refresh the display (directly after the save in Bleeder table for example), my back color never changes. I tried to refresh the various data sources (directly after the save, in the OnVisible of the MainScreen, with a manual button also) but it does not work. 

Is there a way to force a refresh of the TemplateFill property?

 

Thanks in advance.

jp0DWeNy5o.png
Categories:
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @Asmo57 

     

    Lookup returns a table - recommend to use IsEmpty rather than IsBlank if checking for whether table returned contains any rows.

     

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-isblank-isempty

     

    The IsBlank function tests for a blank value or an empty string. The test includes empty strings to ease app creation since some data sources and controls use an empty string when there is no value present. To test specifically for a blank value use if( Value = Blank(), ... instead of IsBlank.

     

    The IsEmpty function tests whether a table contains any records. It's equivalent to using the CountRows function and checking for zero. You can check for data-source errors by combining IsEmpty with the Errors function.

    The return value for both IsBlank and IsEmpty is a Boolean true or false.

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Asmo57 ,

     

    Could you share more details with the lookup condition and DataSourceTable?

    What is the data source of gallery? DataSourceTable?

    What I confused about is that the formula you used is not related to gallery items.

    If the gallery is from DataSourceTable, please try this

     

    If(ThisItem.GniID=galInspections.Selected.gni_id,GreenYellow,White)

     

    If this doesn't make sense, please share more details.

    Sik

  • Asmo57 Profile Picture
    6 on at

    @poweractivate 

    The formula works fine with isBlank but not with IsEmpty, just tested.

     

    @v-siky-msft 

    The gallery uses a variable defined in the OnVisible event (MenuIcons). Like this:

    ClearCollect(
    	MenuIcons,
    	{
    		Title: "BF General Data",
    		Image: BF,
    		Screen: BFGeneralDataScreen,
    		DataSourceTable: '[Ins].[View_BFGeneralData]'
    	},
    	{
    		Title: "BLT Hydraulics",
    		Image: HYD,
    		Screen: BLTHydraulicsScreen,
    		DataSourceTable: '[Ins].[View_BLTHydraulics]'
    	},
    ...)

     

    The behavior is ok at start-up but not well refreshed when underlying tables are updated.

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    @Asmo57  I can't find any relationship between 'MenuIcons' and 'DataSourceTable' in the formula.

    could you describe more about how to check if users has filled a sub table or not?

    we need more information.

    Sik

  • Asmo57 Profile Picture
    6 on at

    My MenuIcons variable contains a list of objects. These objects have a property DataSourceTable which is the name of a SQL Server view. All these views share the same structure, two fields ID (primary key of the subtable) and GniID (foreign key to the main table).

    When browsing my main gallery I get the current GniID to check.

    I then check for every subtables (members of the second gallery) if there is some data for this current GniID with this formula:

    If(IsBlank(LookUp(DataSourceTable,GniID=galInspections.Selected.gni_id)),White,GreenYellow)

    Here is the SQL code of one of the views:

    ALTER view [Ins].[View_Bleeder]
    AS
    select ble_id AS ID,ble_gni_id AS GniID from [Ins].[Bleeder_ble]

    Hope I'm clear... 🙂

     

    Imo the formula is correct because the coloring is good on first execution. But it is not correctly re-calculated everytime data changes in the subtables.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard