Request page option field

I have a request page where I have option field(From a table wit values: Active, inactive).

My probleem is that I can’t figuure out the way how to write a code, what displays an error message when user selects Inactive from the option string.

Example:

user opens report. Request page pops up, if user chooses Active option value, then everyting will be okei and he/she can preview the report, but when user select Inactive option value, then error message will pop up.

If the option is inactive, then why do you want display this option? It’s not good UI to display invalid options.

Otherwise you can display the error when closing the request page.

Not 100% sure if you are talking about the “Option” request page part, or the filter pane below:

If you are talking about the filter pane where the user can select from the list of fields to filter from, you have two options:

Set the TableView for the dataitem to active only (“OptionField”=CONST(Active))

Or raise an error in the “OnPreReport” section of the report for the following case:

YourTable.YourOptionField := YourTable.YourOptionField::Inactive;
IF STRSPOS(YourTable.GETFILTER(YourOptionField), FORMAT(YourOptionField)) > 0 THEN // "Inactive option found in filter
ERROR(‘Cannot use Inactive’);