Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-2.1· AnthropicHugging Face Arena Human Preference 55K

Write an example of a patch function for use in microsoft powerapps

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Mistralmixtral-8x7b-instruct-v0.1’s answer.
  1. User

    Write an example of a patch function for use in microsoft powerapps

  2. Claude Assistant

    Here is an example of a patch function for use in Microsoft PowerApps:

    Patch(
        Orders,
        LookUp(Orders, ID = SelectedOrder.ID), 
        {
            Status: "Shipped",
            ShipDate: Today()
        }
    )
    

    This patch function updates the selected order in the Orders data source. Specifically, it:

    • Orders - Specifies the data source table to update, in this case the Orders table
    • LookUp - Gets the record from the Orders table that matches the currently selected order's ID
    • {Status, ShipDate} - Sets the Status field to "Shipped" and the ShipDate to the current date/time for the matched record

    So this patch would update the status of the selected order to "Shipped" and set the ship date to today's date.

    Some key things to note about Patch:

    • It updates existing records, it does not insert new ones
    • The second argument finds the record to update
    • The third argument sets the fields/values to update

    So in this way you can use the Patch function to selectively update records in a data source in PowerApps.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.