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 Pages / Problems with updateif
Power Pages
Answered

Problems with updateif

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi guys,

I'm having a problem in my app, I'm using updateif with checkbox and gallery for make update in data from sql. The table has some dates like data and id. I want to make a update in column direcor = agree from sql. but with updateif work only with some dates.

I trying with patch but it work only with the firts data from database 

ForAll (RenameColumns (Filter (Descarte_Gallery_2.AllItems; Checkbox1.Value = true);
"COD_FILIAL_PRODUTO"; "COD_FILIAL_PRODUTO1";"DATA_EMISSAO";"DATA_EMISSAO1";"TOTAL_DESCARTADA";"TOTAL_DESCARTADA1";"DESC_FILIAL_REDUZ";"DESC_FILIAL_REDUZ1");
UpdateIf('[dbo].[E_DESCARTES]';COD_FILIAL_PRODUTO = COD_FILIAL_PRODUTO1 && DATA_EMISSAO = DATA_EMISSAO1;
{GERENCIA: "APROVADOos"})


Categories:
I have the same question (0)
  • oliver.rodrigues Profile Picture
    9,449 Most Valuable Professional on at

    Hi

    Please move your question to the correct forum, that way you will get your question answered faster 

     

    This is Power Apps Portals forum

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    sorry i'm new in platform, what can I forum  ?

  • oliver.rodrigues Profile Picture
    9,449 Most Valuable Professional on at

    I guess this would be the right one: https://powerusers.microsoft.com/t5/Building-Power-Apps/bd-p/PowerAppsForum1

  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you want to update multiple records if their checkboxes are checked?

    Could you tell me these fields' data type:COD_FILIAL_PRODUTO, DATA_EMISSAO and GERENCIA?

     

    1/Some sql data type are not supported in powerapps, which will cause some problems.

    Power Apps data type mappings

    TABLE 4
    SQL Server Power Apps
    bigint, decimal, int, money, numeric, smallint, smallmoney, tinyint, float, real Number
    char, nchar, varchar, nvarchar, text, ntext Text
    bit Boolean
    date, datetime/datetime2/smalldatetime, datetimeoffset, time DateTime
    uniqueidentifier Guid

     Note

    If a SQL Server data type is not listed in the table above, it is not supported. Examples of unsupported SQL Server data types include: binary(), varbinary(), image, cursor, rowversion, hierarchyid, sql_variant xml, Spatial Geometry Types, Spatial Geography Types, and table.

    Make sure that GERENCIA is text type.

     

    2/What's more, do not need to rename so many fields, you just  need to rename those used for comparing.

    You could also try patch function instead of updateif function.

    Try this:

     

    ForAll (
     RenameColumns (Filter (Descarte_Gallery_2.AllItems; Checkbox1.Value = true);
     "COD_FILIAL_PRODUTO"; "COD_FILIAL_PRODUTO1";"DATA_EMISSAO";"DATA_EMISSAO1"
     );
     Patch('[dbo].[E_DESCARTES]';
     LookUp('[dbo].[E_DESCARTES]';COD_FILIAL_PRODUTO = COD_FILIAL_PRODUTO1;
     DATA_EMISSAO = DATA_EMISSAO1
     );
     {GERENCIA: "APROVADOos"}
     )
     )
    

     

     

    3/Direct date filters do not work for SQL Server. However, you can create a calculated column that will work. For instance, ALTER TABLE myTable ADD DateAsInt AS (YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date])) and then filter on the calculated number column.

     

    4/Make sure you have primary key in your sql table.

    Or else this sql table will be read-only in powerapps.

     

     

    To sum up, sql table has many limitations in powerapps. Here's a doc about this, please check one by one:

    https://docs.microsoft.com/en-us/connectors/sql/

     

    I also notice that you posted a same issue here:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/update-with-checkbox-on-gallery/td-p/572999

    You add an very important information there:

    it working only with the firts 15 day after this no make update.

    So I think the key problem should be about delegation.

    My opinion about delegation is there, please check that.

     

    Best regards,

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

    Hi @Anonymous ,

    I find that you mark my answer here:
    https://powerusers.microsoft.com/t5/Building-Power-Apps/update-with-checkbox-on-gallery/m-p/573759#M178743

     

    So delegation is your problem.

    Since your problem has be solved, could you mark my answer here too?

    Thanks!

     

    Best regards,

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
DP_Prabh Profile Picture

DP_Prabh 51

#2
rezarizvii Profile Picture

rezarizvii 35

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 33 Most Valuable Professional

Last 30 days Overall leaderboard