Skip to content

Keep History Tables

Step 3 of 6

Overview

To enhance user experience and flexibility, we are introducing two new features in the Schedule Sessions Copilot: Prompt Options and History Tracking. This will allow users to experiment with different event durations using predefined choices and keep a history of generated schedules.

1. Add Prompt Options

To facilitate user interaction with different event durations, you'll implement an enum that provides predefined choices for the event's duration.

  • Location: Create this enum at "\src\4-ScheduleSessionsCopilot\PromptDialog\ConferenceDuration.Enum.al"
enum 50201 "GPT Conference Duration"
{
    value(0; "1 Day")
    {
    }
    value(1; "2 Days")
    {
    }
    value(2; "3 Days")
    {
    }
    value(3; "3.5 Days")
    {
    }
}

This enum will allow users to choose the duration of the event when generating the schedule.

2. Define History Tables

Generations History

To track the history of the applied prompt options (such as duration) for each generation, create the following table:

  • Location: "\src\4-ScheduleSessionsCopilot\PromptDialog\CopScheduleSessionHst.Table.al"
table 50204 "GPT Cop. Schedule Session Hst."
{
    Caption = 'Schedule Session History';
    TableType = Temporary;

    fields
    {
        field(1; "Generation Id"; Integer)
        {
            Caption = 'Generation ID';
        }
        field(10; "Conference Duration"; Enum "GPT Conference Duration")
        {
            Caption = 'Conference Duration';
        }
    }

    keys
    {
        key(PK; "Generation Id")
        {
            Clustered = true;
        }
    }
}

This table will keep the history of which durations were used in each generation attempt.

Info

Source table for the PromptDialog should always have a primary key of Integer type. One record per generation is maintained in the history table.

Session Records

To maintain a detailed record of each scheduled session per generation, implement this table:

  • Location: "\src\4-ScheduleSessionsCopilot\PromptDialog\CopScheduleSession.Table.al"
table 50205 "GPT Cop. Schedule Session"
{
    TableType = Temporary;

    fields
    {
        field(1; "Generation Id"; Integer)
        {
            Caption = 'Generation ID';
        }
        field(10; "Session Code"; Code[20])
        {
            Caption = 'Session Code';
        }
        field(11; "Session Date"; Date)
        {
            Caption = 'Session Date';
        }
        field(12; "Session Start Time"; Time)
        {
            Caption = 'Session Start Time';
        }
        field(13; "Session End Time"; Time)
        {
            Caption = 'Session End Time';
        }
        field(14; "Track No."; Integer)
        {
            Caption = 'Track Number';
        }
        field(20; "Description"; Text[250])
        {
            FieldClass = FlowField;
            CalcFormula = Lookup("GPT Session".Description where("Code" = field("Session Code")));
            Editable = false;
        }
    }

    keys
    {
        key(PK; "Generation Id", "Session Code")
        {
            Clustered = true;
        }
        key(SK; "Generation Id", "Session Date", "Session Start Time")
        {
        }
    }
}

This table records each proposed session's schedule for every generation, ensuring that each generation's output is trackable and distinct.

Conclusion

With these structures in place, the Schedule Sessions Copilot will not only allow for flexible scheduling experiments but also maintain a detailed record of all scheduling attempts. This functionality is essential for refining event plans and enhancing user experience.

Next Steps

Next, proceed to implementing the Prompt Dialog where these configurations will be utilized to allow user interactions and history viewing.