Handling optional numeric parameters

(3 posts) (2 voices)

Tags:

No tags yet.

  1. apao, Member

    Hello,

    When a user doesn't input an optional numeric parameter, MyDBR assigns 0 to this parameter.
    My problem is that I need to be able to know when the user inputs a value and when he does not. For most cases, this is not a problem but for some, the user will deliberately input a 0, so I won't be able to know if he actually input a 0 or if he didn't input anything at all.

    Would it be possible to change the behaviour of MyDBR (via a config file for instance) so that it assigns NULL to a numeric parameter instead of 0 when the user doesn't input anything?

    Thanks in advance for considering my request.

    PS: this would only concern numeric parameters because there's no problem with character parameters thanks to the '' (empty string) value

  2. myDBR Team, Key Master

    You can set the preference in the user/defaults.php:

    $mydbr_defaults['parameters']['empty_numeric_results_null'] = true;

    will make an empty optional numeric value to pass NULL into the report. Similar option exists for strings (empty_string_results_null).

    --
    myDBR Team

  3. apao, Member

    Fine, I'll try that!
    Many thanks!


Reply

You must log in to post.