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 / Invalid operation divi...
Power Apps
Answered

Invalid operation division by zero - Not in Edit mode but in Run Mode

(0) ShareShare
ReportReport
Posted on by 678

I have seen many posts about this and the answer seems to be to wrap whatever is causing it in a IfError function.
The problem is that this only occurs when "running the published version". It can't replicate in the edit mode, so hence I can't use "Monitor" to figure out what is causing it. In edit mode, running monitor, the only warnings I get are surrounding delegation which I get. Any tips of how to solve this.

I've looked at the onVisible...and I'm not sure I need to do add IfError anywhere here... see screen shot...it's a bunch of UpdateContext vars that I can't believe would cause this and then a ClearCollect andd

UpdateContext(
 {
 _showDeleteContainer: false,
 _end: selectedRegulation.EndDate,
 _updateTab: 1,
 _showEnactDate: If(
 IsBlank(selectedRegulation.EndDate),
 false,
 true
 ),
 _showEffectiveDate: If(
 IsBlank(selectedRegulation.DateEffective),
 false,
 true
 ),
 locShowValidation: {
 Hyperlink1: false,
 Hyperlink2: false
 },
 hasChangedRegtitle: false,
 hasChangedSeverity: false,
 hasChangedOwner: false,
 hasChangedSubjectMatter: false,
 hasChangedDateProposed: false,
 hasChangedDateEnacted: false,
 hasChangedDateEffective: false,
 hasChangedJurisdition: false,
 hasChangedImpactedSubsidiary: false,
 hasChangedHyperlink1: false,
 hasChangedHyperlink2: false,
 hasChangedRegsummary: false,
 hasChangedImplications: false,
 hasSelectedJurisdition: false,
 hasSelectedImpactedSubsidiary: false,
 hasSelectedSubjectMatter: false,
 hasSelectedLawTopics: false,
 hasSelectedRequirementTypes: false
 }
);
Reset(InpNotes);
Reset(InpAction);
Reset(InpLatest);
Reset(DrpStatus);
Reset(DrpStage);
Reset(DrpProposedSASAction);
Reset(DrpIssuedStatement);
Reset(DrpSupplyChainPart);
Reset(DrpSupplyChain);
Reset(DrpScope);
Reset(inpURL1);
Reset(inpURL2);
Reset(datProposed);
Reset(datEnact);
Reset(DatEffective);
Reset(InpImplications);
Reset(inpRegulationSummary);
Reset(DrpSeverity_3);
Reset(CmbGeoCountries_1);
Reset(CmbOwner_1);
Reset(CmbGeoRegions_1);
Reset(TogGlobalReach);
Reset(cmbSubject);
Reset(CmbRequirementTypes);
Reset(DrpScope);
Reset(CmbLawTopics);
Reset(InpLawDescribe);
Reset(InpTriggers);
Reset(DrpSupplyChain);
Reset(InpSupplyChainDescribe);
Reset(DrpSupplyChainPart);
Reset(InpSASPutinPlace);
Reset(InpResponsibility);
Reset(InpReporting);
Reset(InpRegTitle_1);
Reset(chkEnact);
Reset(chkEffect);
UpdateContext(
 {
 defaultStatus: selectedRegulation.Status,
 defaultStage: selectedRegulation.Stage,
 defaultSASAction: selectedRegulation.mrcSASAction,
 defaultAction: selectedRegulation.mrcAction,
 defaultLatest: selectedRegulation.mrcLatestSummary,
 defaultNote: selectedRegulation.mrcOtherNotes,
 defaultProposedSASAction: selectedRegulation.mrcProposedActionID,
 defaultIssuedStatement: selectedRegulation.mrcIssuedStatement,
 formChanged: false
 }
);
ClearCollect(
 LawTopics,
 ForAll(
 Filter(
 ForAll(
 Split(
 selectedRegulation.LawTopics,
 ","
 ),
 {Result: ThisRecord.Value}
 ),
 !IsBlank(Result)
 ),
 {
 ID: Result,
 Title: LookUp(
 ListDictionary,
 ID = Value(Result),
 Title
 )
 }
 )
);
/* reset the change triggers */
UpdateContext(
 {
 changesMade: false,
 changesMadeESG: false
 }
);

As you can tell by the onVisible, the screen is pretty packed, so I'm at a loss to how to solve this. I already did a search for any "/" and didn't find any.


Categories:
  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    HI @sasrsc, Basically you need to find a control or variable where you are doing any division and then use the if condition. Please check this: https://powerusers.microsoft.com/t5/Building-Power-Apps/invalid-operation-division-by-zero-Error/m-p/2243711

     

    Also, I saw you are doing lots of reset. It is just a suggestion which is not related to your primary issue. Instead of using reset function to reset many controls, you can simply use below code 

    UpdateContext({var_Reset:false});
    UpdateContext({var_Reset:true});

    And then use var_Reset variable on the Reset property of controls.

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • sasrsc Profile Picture
    678 on at

    Thanks @ANB for the tip about Resets... I see Reza did a quick video on it.
    https://www.youtube.com/watch?v=kGh3uup0TBM
    I won't tag your response as the solution just because the resets is a separate topic.

    There are a few other similar threads, like you mention. But none seem to reference and issue with Run vs. Edit. So I don't have the option of using Monitor to help point me to the culprit of this message. The onVisible doesn't seem to have any link to it, but I've got a screen with multiple tabs and many input fields, so it's hard to locate all the possible causes. I was wondering what others would do. I've looked at the onVisible and that seems fine to me (except for too many resets) but am I meant to check every single object on the screen one by one looking at the items, default, defaultSelected for each object as appropriate?

  • Verified answer
    ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    @sasrsc , Monitor is the tool that can help you but again while in edit mode it is not working than one last option that i can suggest that to hide the error message. Please check this which can help you to hide the error message if that error is not breaking your functionality: https://powerusers.microsoft.com/t5/Building-Power-Apps/Arguments-to-the-function-must-be-finite/m-p/2361349#M589531

     

    Otherwise, I would suggest to reach out to MS support.

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • sasrsc Profile Picture
    678 on at

    Using that method in the other thread helped me solve the issue immediately. It was some obscure property setting that it didn't like. I would never have found that, and the more detailed message provided the clue by appending the param and updating the app.onerror. Wow, made my day!

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard