Post

#PowerPlatformTip 82: 'Automated Code Commenting'

#PowerPlatformTip 82: 'Automated Code Commenting'

TL;DR: Let ChatGPT add clear comments to your Power Apps formulas, paste the formula, ask it to comment without changing the code, then review and apply.

💡 Challenge

Writing code comments in your Power Apps formula can be time-consuming and sometimes overlooked, yet it’s crucial for maintainability and collaboration.

✅ Solution

Leverage AI with ChatGPT to automatically generate detailed comments for your Power Apps formulas.

🔧 How It’s Done

Here’s how to do it:

  1. Prepare your formula
    🔸 Ensure your Power Apps formula is ready for commenting.
  2. Use ChatGPT
    🔸 Input your formula into a ChatGPT-enabled platform.

    🔸 Use this prompt: “Please add code comments to my Power Apps formula, but keep the code as it is.”

  3. Review and implement
    🔸 Review generated comments for accuracy.

    🔸 Incorporate the comments into your Power Apps formula.

🎉 Result

You’ll have a well-commented Power Apps formula that is easier to understand, maintain, and collaborate on.

🌟 Key Advantages

🔸 Efficiency: Save time by automating the commenting process.

🔸 Clarity: AI-generated comments can provide insights you might have missed.

🔸 Collaboration: Well-commented code is easier for team members to understand and work on.

🎥 Video Tutorial

🛠️ FAQ

1. What versions of ChatGPT work best for code commenting?

GPT-4 or code-capable models deliver more accurate comments, but GPT-3.5 can also be effective for simpler formulas.

2. How do I ensure the generated comments accurately reflect my logic?

Always review and validate AI-generated comments before implementation to confirm they match your formula’s intent.

3. Can I automate commenting for multiple formulas at once?

Yes, you can batch multiple formulas in one request to ChatGPT to streamline the process, but monitor response size and clarity.

🔸 #PowerPlatformTip 65: ‘Automate Documentation with PowerDocu’ - generate full app and flow documentation once your formulas are commented.

🔸 #PowerPlatformTip 116: ‘AI Automated Solution Design’ - use AI earlier in the process, to draft the solution design itself.

This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy – live Power Platform workshops, free or CHF 49. Join the workshop waitlist to get notified about new dates. For companies that want this implemented for them, see KMUpower – Power Platform consulting & automation for SMEs (DACH).

This post is licensed under CC BY 4.0 by the author.

Microsoft and the Power Platform product names (for example Power Apps, Power Automate, Copilot Studio) are trademarks of the Microsoft group of companies. This is an independent website. It is not operated, sponsored or endorsed by Microsoft.