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 / Exception Handler in C...
Power Apps
Unanswered

Exception Handler in Collection to Dataverse Table

(0) ShareShare
ReportReport
Posted on by 538

Experts,

 

I have got Collection named as DailyinventoryL  and Dataverse table named as  Dailyinventory . Following button click is to send the data from collection to table.

 

Set(Varlastno1 ,
First(
FirstN(Sort(DailyinventoryL,sno, Descending),
1
)
).sno);


ForAll(
DailyinventoryL,
Patch(
Dailyinventory,
Defaults(Dailyinventory),
{
crf99_materialno: Materialno,
crf99_materialdesc: Materialdesc,
crf99_plant: plant,
crf99_qty: Qty,
crf99_bbd: BBD
}
)
);

Set(
varNotifytest9,
"Transmit Completed"
);
Set(Varlastno1 ,
First(
FirstN(Sort(DailyinventoryL,sno, Descending),
1
)
).sno);

------

 

Issue here is that duplicated data is transmitted to table whenever clicking the button 

 

Requirement here is that button should trigger error message if that is duplicated is passed.

 

Tried with workaround like bringing the last row of the collection records as variables. 

Var created. 

 

Set(Varlastno1 ,
First(
FirstN(Sort(DailyinventoryL,sno, Descending),
1
)
).sno);

 

Var is passed to one label. So whenever button is clicked then last row number will appear in the label12.

 

Now how to send the collections to table which is after the lastrow number which is appearing in label12. Not sure this is correct way. 

Categories:
I have the same question (0)
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Hi, you will want to look at the datasource for the last submitted item rather than the collection:

    Refresh(Dailyinventory);
    Set(Varlastno1,
     First(
     Sort( Dailyinventory, sno, Descending)
     ).sno
    );

     

    This way it will never use a Varlastno1 that is already in use, as it checks the datasource for the most recent number

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 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard