Assigning variables

(7 posts) (2 voices)
  1. ajdjackson, Member

    Hi

    This is a follow on to my queries last night.

    I believe my issue is that I can't figure out a way to assign a user selection to input field that will be used later.

    If the fields were in a table I know how to update them with the user's input but how do you assign a value to a filed that is not part of a table.

    I thought of creating a temporary table to store these inputs but is there a better way.

    Here is a simple expamle that I can't get to work:

    DROP PROCEDURE IF EXISTS sp_DBR_Test_Select
    $$
    CREATE PROCEDURE sp_DBR_Test_Select()
    BEGIN select 'dbr.report', 'sp_DBR_Insert_Mat_Inv','inSupp_ID=[SuppID]'; select 'dbr.editable', '[SuppID]','sp_DBR_dummy_edit_input','type=select','select=select hilmark.tblsuppliers_j.tblSupplier_Ref FROM hilmark.tblsuppliers_j where hilmark.tblsuppliers_j.tblSupplier_isSubbie = 0 order by hilmark.tblsuppliers_j.tblSupplier_Name'; SELECT
    '' as 'Supplier Ref[SuppID]'; END
    $$

    At the moment the 'sp_DBR_dummy_edit_input' is empty as I don't know what to put in there as I'm not updating a table at this point.

    Once the user has select a value from the select list I wish to use this value in a linked report. At present the linked report is just to show this value.

    DROP PROCEDURE IF EXISTS sp_DBR_Insert_Mat_Inv
    $$
    CREATE PROCEDURE sp_DBR_Insert_Mat_Inv(inSupp_ID varchar(25))
    BEGIN select inSupp_ID as Supplier; END
    $$

    In essence how do I assign the value from the select list to the [SuppID] field?

    I'm really stuck at this and it sounds so simple.

    Thanks

    Jake

  2. myDBR Team, Key Master

    Jake,
    please read the previous posts carefully. You are trying to do things in a way which is not correct.

    The purpose is *NOT* to create an empty editable entry, let user fill it and then call the report which will enter the data to the database. This is what it looks you are trying and it is *not* the way you should do it, it is too complicated.

    The right way is just to call a report handling the new row creation and allow user to enter the parameters. Once the report is run, the data is entered into the database and the list if refreshed.

    --
    myDBR Team

  3. ajdjackson, Member

    Hi

    Ok when I look at what you recommended last night I'm still confused especially with what has to go into the 'dbr.editable' reports as the fields at this time are not in a table. Or is this what I'm missing - do I have to insert a blank record into table first and then edit that?

    Is it possible for you to give a simple working example of what I need which is:

    Create a couple blank fields, let the user enter data into these fields via text, select an item from a list, and from the datepicker, and then finally insert these values into a table.

    I'm sorry I'm being thick at the moment and obviously trying your patience but I've so many of these input reports to create I would like to get it working and working efficiently.

    Cheers

    Jake

  4. myDBR Team, Key Master

    Jake,

    Is it possible for you to give a simple working example of what I need which is:

    Create a couple blank fields, let the user enter data into these fields via text, select an item from a list, and from the datepicker, and then finally insert these values into a table.

    Again, this is not the way you should do it. You can do it much easier by just using a linked report which asks user the necessary data, insert the data in the database and refreshes the list.

    --
    myDBR Team

  5. ajdjackson, Member

    Hiya

    Result! The penny dropped. I have it working now and yes it was so easy. I have just created a linked update report that asks for the data and have created the parameter queries to suit. So easy once you know :)

    I have 2, not the end of the world, questions.

    I am calling the 'sp_DBR_Enter_New_Supp_Inv' report via a button. The originating report has a parameter inPlot_ID. Is there any way I can have this parameter sent to the 'sp_DBR_Enter_New_Supp_Inv' report? I have tried all the usual ways such as 'inPlotID=[PlotID]' etc but get errors such as column does not exist.

    DROP PROCEDURE IF EXISTS sp_DBR_Materials_Input
    $$
    CREATE PROCEDURE sp_DBR_Materials_Input(inPlot_ID varchar(25))
    BEGIN select 'dbr.parameters.show'; select 'dbr.title', '';
    select 'dbr.subtitle', 'Enter New Invoice Details'; select 'dbr.button', 'Enter New Invoice';
    select 'dbr.report', 'sp_DBR_Enter_New_Supp_Inv','createx[]';
    select 'dummy';
    select 'dbr.embed_object','createx[]';

    My other question is that when the 'sp_DBR_Enter_New_Supp_Inv' report is displayed allowing me to enter the data the button at the bottom has Run Report as its dialogue. Is there any way to change this to say Save Invoice?

    Many thanks for help and patience.

    Relieved

    Jake

  6. ajdjackson, Member

    Hi

    Just discovered how to change the button text by changing the Run report-button: in the report's information screen.

    Just need to figure out how to pass that parameter now.

    Cheers

    Jake

  7. myDBR Team, Key Master

    Passing parameters works as in any other linked report:

    select 'dbr.button', 'Enter New Invoice';
    select 'dbr.report', 'sp_DBR_Enter_New_Supp_Inv','createx[]', 'inPlot_ID=plot_id'; select inPlot_ID as 'plot_id';

    --
    myDBR Team


Reply

You must log in to post.