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 / Update end submit fiel...
Power Apps
Unanswered

Update end submit fields to a Microsoft list with a PowerApp button

(0) ShareShare
ReportReport
Posted on by 413

Hi guys, 

 

First try to build an app, sorry for my ignorance with these issues. 

I make a Microsoft list with:

 

Linea: text Field

Evento: text field

Inizio: Date/Time field

Fine: Date/Time field

Durata: calculated column.

 

Now, i have to update the rows of my list with just a button.

For example, we have button1 wich have to:

 

-set  Linea field to "T6" value

-set Inizio field to now

-set the Fine field field of the previous row to now

-set Evento field to "Blocco"

 

and then publish these info on my list. 

I try both the set and update context apporach (I prefer "set()" because i lice to use global variables) but the corrector says that i'm using unexpected characters:

 

For example: 

 

 

 

 

Set(Linea: "T6");

 

 

 

seems that ";" is unexpected".

 

Am I doing this on the right way?

 

Thanks.

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Calcioscacchi 

    The set function would be used as such:

    Set(Linea, "T6");

     

    But keep in mind, this is only setting a variable.  This has nothing to do with what you are trying to accomplish with your data in the list.

     

    I hope this is helpful for you.

  • Pstork1 Profile Picture
    69,562 Most Valuable Professional on at

    Set is used to update the value of variables.  Patch() is used to update the value of a record in a data source like SharePoint. Here's an article on how to use Patch(). 

    Patch function in Power Apps (contains video) - Power Platform | Microsoft Docs

    For the ';' the problem may be your region.  Different areas and languages around the world use different separators. ';' is what is used in the US. Take a look at the table here that explains the differences for different regions. Build global support into canvas apps - Power Apps | Microsoft Docs

  • Calcioscacchi Profile Picture
    413 on at

    thanks, i'll start to study patch function.

  • Calcioscacchi Profile Picture
    413 on at

    Thanks @Pstork1 , it works!

    Last question, i need to edit a field of the previous row. Is that possible?

     

    Thanks.

  • Pstork1 Profile Picture
    69,562 Most Valuable Professional on at

    There are two forms of the Patch() function.  One uses defaults(datasourcename) as the second parameter.  The other uses something to identify the specific row being edited.  This could be the selected value of a Gallery if the gallery shows the records or it could be a Lookup() that uses a specific value of one of the fields to find the matching record.  That's covered in the article also.

  • Calcioscacchi Profile Picture
    413 on at

    According to what you say, i'm trying to identify the ID of the row that I want to edit (see this as start point: 

    https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-change-value-of-previous-record-s-field-while-submitting/td-p/494985)

     

    Now, i'm trying, without setting a gallery, to identify my row:

     

    Patch('Segnalazione eventi macchina';Defaults('Segnalazione eventi macchina');{Linea: "T6";Evento: "Blocco";Inizio: Now()});;
    Patch('Segnalazione eventi macchina';LookUp('Segnalazione eventi macchina';ID=ThisRecord.ID-1);{Fine: Now()});;
    Notify("Inserimento OK")

     

    Question: the first patch function create a row itself? Because if the answer is yes, this code should work. Instead, the "ID=Thisrecord.ID-1" is not correct.

     

    I think that I need to set a gallery, but do you know how to fix this "easily"? Maybe is just my code wrote in a wrong way 😛

  • Pstork1 Profile Picture
    69,562 Most Valuable Professional on at

    The first line is correct for creating a new record.  It is not required when updating an existing record. Your second line is correct also, but thisrecord.ID-1 won't give you the right value.  You have to know what the ID is or use a different field, like Title, to find the record you want.  In the post you reference they are using a gallery.  In your case there is no thisrecord to get the ID from.

  • Calcioscacchi Profile Picture
    413 on at

    @Pstork1 wrote:

    Your second line is correct also, but thisrecord.ID-1 won't give you the right value.  You have to know what the ID is or use a different field, like Title, to find the record you want.


    Do you mean that without a gallery the ID column is useless? Isn't it a number format column that I can use as a table index?

    Or you are trying to say that "Thisrecord" is not the right function in my case?

  • Pstork1 Profile Picture
    69,562 Most Valuable Professional on at

    I'm saying there is no thisrecord without a form or gallery.  You could put a textinput control on the page and use that to get the ID if you knew what it was and your code would work.  Knowing the exact ID isn't common so usually you work with something else that is known.

  • Calcioscacchi Profile Picture
    413 on at

    Thanks.

     

    Why are you saying that knowing the ID in not common? As you can see here, I have the ID column, just showing it from the "Show/Hide columns".

    Calcioscacchi_0-1661439534312.png

     

    Calcioscacchi_1-1661439631141.png

     

     

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard