How to build select dropdown list using stored proc with variables

(3 posts) (2 voices)
  1. clickityclack, Member

    Hello,
    I have a settings page that has many numeric values that need to be prefilled as select lists.

    i.e.
    Bedrooms 1-10 (whole numbers)
    Bathrooms 0-8 (.5 increments)
    Sqft 0-5000 (250 increments)

    I have created a stored procedure with some input values that returns exactly the values I want for each dropdown.

    The issue is chaining a dynamic stored procedure on an editable field. When the page renders, it does not fire the stored proc to retrieve the list of values.
    I have tried several ways of writing the syntax, but it seems like MyDbr doesn't like the dynamic values in the call.

    Here is what the code for the dropdown(s) look like:

    select 'dbr.editable', 'Max Bedrooms', 'sp_DBR_field_updater', 'client_id=(client_id)', 'column_name="beds_max"', 'type=select','select=call sp_steps_dynamic_num("whole_num",1,10,0,0)';

    select 'dbr.editable', 'Max Bathrooms', 'sp_DBR_field_updater', 'client_id=(client_id)', 'column_name="beds_max"', 'type=select', 'select=sp_steps_dynamic_num("decimal_num",0,10,.5,0)';

    Do you have any suggestions how to write this syntax so it will work?
    Thanks!!!

    PS -
    Viewing the source shows that it is not rendering the list
    <td data-url="[12,"1","'beds_max'","'dba'"]" data-urlhash="f4c1c36ee4edb9c6b5aaab2ad3e5a3de9cf4f72d" data-type="string" data-options="{'type':'select'}" data-selectquery="q=sp_steps_dynamic_num_selection_test%2815%29&h=5b1bg5445a091ba1477064b17164fa3" id="dbr_rt3tr1c4" class="pageview_cell2 cell editable" >5</td>

    Here is the HTML from another test select box with a simple union statement to generate the list:
    <td data-url="[12,"1","'beds_min'","'dba'"]" data-urlhash="601c87d9ba7e5d3bfdff33105198d58a83c80d48" data-type="string" data-options="{'type':'select'}" data-select="[{'i':'0','v':'0'},{'i':'1','v':'1'},{'i':'2','v':'2'},{'i':'3','v':'3'},{'i':'4','v':'4'},{'i':'5','v':'5'},{'i':'6','v':'6'},{'i':'7','v':'7'},{'i':'8','v':'8'},{'i':'9','v':'9'},{'i':'10','v':'10'}]" id="dbr_rt3tr1c3" class="pageview_cell2 cell editable" >2</td>

  2. myDBR Team, Key Master

    Hi,
    you were close. Just remember that myDBR works also with other databases than MySQL/MariaDB, so MySQL specific syntaxes are not used in myDBR side.

    You can use syntax:

    'select=sp_steps_dynamic_num "whole_num",1,10,0,0';

    You can also use ColumnReferences:

    'select=sp_steps_dynamic_num [num_col],[id],10,0,0';

    --
    myDBR Team

  3. clickityclack, Member

    Awesome - that worked!
    Thanks!!!


Reply

You must log in to post.