Skip to main content
All docs
V25.1
  • AIReportPrompt Class

    A prompt in natural language used to generate a report.

    Namespace: DevExpress.AIIntegration.Reporting

    Assembly: DevExpress.AIIntegration.Reporting.Common.v25.1.dll

    NuGet Package: DevExpress.AIIntegration.Reporting.Common

    Declaration

    public class AIReportPrompt

    Remarks

    Create an AIReportPrompt object and specify the following properties:

    AIReportPrompt.Text
    Specifies the prompt text.
    IReportPrompt.Title
    Specifies the prompt title.

    Web Report Designer

    Use the ConfigurePredefinedPrompts(Action<List<AIReportPrompt>>) method to change predefined prompts shown in the Report Wizard.

    The following code snippet removes all DevExpress built-in prompts and adds two custom prompts:

    using DevExpress.AspNetCore.Reporting;
    using DevExpress.AIIntegration.Reporting;
    //...
    builder.Services.AddDevExpressAI(config => {
        config.AddWebReportingAIIntegration(aiConfig => {
            aiConfig
            .AddPromptToReportConverter(options => {
                options.ConfigurePredefinedPrompts(prompts => {
                    prompts.Clear();
                    prompts.Add(new AIReportPrompt {
                        Title = "Custom Prompt 1",
                        Text = "Custom Prompt Text"
                    });
                     prompts.Add(new AIReportPrompt {
                         Title = "Custom Prompt 2",
                         Text = "Custom Prompt Text"
                    });
                });
            });
        });
    });
    

    The following images shows the resulting Enter Report Description page in the Report Wizard:

    Web Report Designer - Enter Report Description Page with custom Prompts

    Review the following help topic for more information on how to create and manage prompts: Generate Reports From Prompts in Web Report Designer (CTP).

    WinForms Report Designer

    Use ReportPromptToReportBehaviorProperties.PredefinedPrompts property to display prompts in the Report Wizard.

    The following code snippet obtains built-in DevExpress prompts from AIReportPromptCollection, creates a custom prompt (an AIReportPrompt object), and adds this prompt to the collection. The collection is assigned to the ReportPromptToReportBehaviorProperties.PredefinedPrompts property.

    using DevExpress.AIIntegration.WinForms.Reporting;
    // ...
    public partial class Form1 : Form {
        public Form1() {
            behaviorManager1.Attach<ReportPromptToReportBehavior>(reportDesigner1, behavior => {
                // Obtain built-in DevExpress prompts from the collection.
                var collection = AIReportPromptCollection.GetDefaultReportPrompts();
                // Create a custom prompt.
                AIReportPrompt customPrompt = new AIReportPrompt();
                customPrompt.Title = "Custom Prompt";
                customPrompt.Text = Prompts.CustomAIReportPrompt;
                // Add this prompt to the collection.
                collection.Add(customPrompt);
                // Display Prompts in the Report Wizard.
                behavior.Properties.PredefinedPrompts = collection;
            });
        }
        public static class Prompts {
            public const string CustomAIReportPrompt = "Create Sample Report:\r\n \r\nPage Setup:\r\n- Paper Size: A4\r\n- Report Margins:\r\n - Top & Bottom: 40\r\n - Left & Right: 60\r\n\r\nReport Header:\r\n- Title: Sample Report\r\n- Alignment: Center\r\n- Font: Comic Sans MS, 12pt, Bold\r\n\r\nCreate a horizontal table with the four column headers that correspond to fields in the bound data source.\r\n\r\nFont for column headers: Comic Sans MS, 12pt, Bold\r\n \r\nDetail Section:\r\nBind data cells to the fields corresponding to the column headers defined in the Group Header\r\nFont for data cells: Comic Sans MS, 12pt, Bold\r\n \r\nSummary Section:\r\nInclude calculated values for bound fields.\r\nSummary type: [Sum]\r\nFont for summary values: Comic Sans MS, 12pt, Bold";
        // ...
        }
    }
    

    The following image illustrates the result:

    WinForms Report Designer - Custom Prompt in the Report Wizard

    Review the following help topic for more information on how to create and manage prompts: Prompt to Report Behavior in the WinForms Report Designer (CTP).

    Inheritance

    Object
    AIReportPrompt
    See Also