Discussions

Expand all | Collapse all

API_GenAddRecordForm & Dashboard Buttons Widget

  • 1.  API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 24 days ago
    Edited by Tim Egerton 24 days ago

    Hi,

    We are trying to use the Dashboard Button widget (Page URL option) to add a new record via three different forms (each in a different language) to a single table using API_GenAddRecordForm as per below.

    https://TARGET DOMAIN/db/bqwga5efh?a=API_GenAddRecordForm&_dfid=2 & apptoken=APP TOKEN

    https://TARGET DOMAIN/db/bqwga5efh?a=API_GenAddRecordForm&_dfid=11 & apptoken=APP TOKEN

    https://TARGET DOMAIN/db/bqwga5efh?a=API_GenAddRecordForm&_dfid=10 & apptoken=APP TOKEN

    However it is using the same form (dfid=2) for each.

    dfid=2 is the add new record form when you are logged in.

    It is a EOTI app.

    Thanks,

    Tim



    ------------------------------
    Tim Egerton
    ------------------------------



  • 2.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 24 days ago

    Can you please post the exact text of the widget code For any one of the buttons. Or are you actually saying that that is your actual code.  I do not need to know your target domain but everything else.

    if that is your actual code then try closing up the spaces between where you specify the form ID and where are you specify the app token.

    You are building a URL that needs to travel through the Internet. URLs do not ever have spaces.



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 24 days ago

    Hi Mark,

    Removed the spaces and still no working.

    Could it be something to do with "Set how different roles uses these forms" option?

    Thanks,

    Tim



    ------------------------------
    Tim Egerton
    ------------------------------



  • 4.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 24 days ago

    The syntax for the form ID was incorrect. Remove the underscore. 

    Also, while this was probably not the error as the parameter would be ignored, you do not need to provide an application token when a human user is editing or adding a record manually. 

    https://TARGET DOMAIN/db/bqwga5efh?a=API_GenAddRecordForm&dfid=2



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 24 days ago

    Hi Mark,

    Thanks works perfectly, sometimes the smallest thing!

    Is there anything we need to add to the URL to get the API to work on a EOTI dashboard page?

    Tim



    ------------------------------
    Tim Egerton
    ------------------------------



  • 6.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 24 days ago

    There is nothing different about EOTI in terms of the syntax of the API.



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 7.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 22 days ago

    Hi Mark.

    Thanks.

    Once a record has been added how can we display the record and associated form, the form it was created with, in edit and view modes?

    Tim



    ------------------------------
    Tim Egerton
    ------------------------------



  • 8.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 21 days ago

    OK, now I understand the true nature of your problem. You have one table but you are trying to allow the users to interact on a trilingual basis.

    This is actually a very interesting challenge. If you try to use the multiple form approach then there are only really two ways to control which form is used. One is my role but in your case these are EOTI users so they are all in the same role and one is by report.  I can't really see how that second option is useful in your case.

    I actually think the best solution in your case is to have formula fields to calculate floating labels for the input fields. So the very first field on the form would be a multiple-choice field for the language.  So for example English French and Spanish might be the three choices. The Dashboard button to Add a record would contain syntax to populate those fields.

    So or example if the language Field ID was #10, then

    https://TARGET DOMAIN/db/bqwga5efh?a=API_GenAddRecordForm&_fid_10=Spanish

    Then what you would do is arrange your fields probably vertically on the form so that the first column of fields would actually be formula fields that would calculate the label for the field and then the field right beside it would have its own native label suppressed (so no label showing) using the form properties.

    Here is an example of he formula for he floating label.  Quick Base is a bit unpredictable with accented characters, so in the end you may need to forgo the accents. 

    Case([Language],

    "French", "Prénom",

    "Spanish", "Primer Nombre",

    "English", "First Name")



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 9.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 21 days ago

    Hi Mark,

    Thanks for the reply.

    A bit more information might be helpful.

    The app is for international travel into a country.

    The form is in two parts (Tabs) (a) initial registration of interest to travel and (b) health declaration relating to COVID.

    Part (a) can be done at anytime while part (b) must be done within 24 hours of actual travel.

    We have copied the form and used Alt Text to display three languages, all record fields remain the same.

    Part (a) involves initial record creation and displays the first Tab only.

    We have three buttons on the EOTI home page each linked to the respective "language" form using APIGenAddRecordFrom.

    For part (b) we are using a search widget with exact match on First Name, Last Name and Passport Number.

    This returns the record for editing and displays both Tabs.

    However it is not bring the form used to create the record i.e. if the Spanish form was used to create the record in edit it is displaying the English form.

    We have tried adding a formula url field to each form as follows URLRoot()&"db/"&Dbid()&"?a=dr&rid="&ToText([Record ID#])&"&dfid=11" were dfid=11 is the French form. But no success.

    Tim



    ------------------------------
    Tim Egerton
    ------------------------------



  • 10.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 21 days ago

    I will need to better understand your workflow. I think that we can get this to work if the buttons on the Dashboard return the user to the Dashboard after the save as opposed to displaying the saved record on the wrong form.

    Is that your issue that when the record is initially saved, it displays on an incorrect form as opposed to landing the user on some kind of Thank You page?



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 11.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 20 days ago

    Hi Mark,

    What we are trying to achieve is being able to view and edit the saved record using the form (either English, or French, Spanish Alt Text versions) it was created with. Effectively linking the form to the record.

    In the first record create instance this is done using the three Dashboard buttons, each linked to a from. However in the second view/edit instance we are "losing" the form with only the English form displaying.

    Returning the user to the Dashboard after saving would work.

    Thanks,

    Tim



    ------------------------------
    Tim Egerton
    ------------------------------



  • 12.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 20 days ago
    Edited by Mark Shnier (YQC) 20 days ago

    .. if you are in a hurry we can book some consulting time to get this all sorted out quickly, but I don't mind helping out on this forum as time allows.

    I suggest that you capture the language on the record itself if you have not already done so.  That can be done with the Add Button to populate the Language field.  Then you need to control where the user lands after the initial save so that they end up back on the dashboard.  

    The button on the dashboard to do that search needs to result in a report hit (I assume just one hit) for the single record the user was looking for.  That report will have a single URL formula button to click which will edit on the correct form and then on save land the user back on the dashboard.

    I suggest that you build these buttons on fields on any table as you will need to generate the code. If you create a formula URL field and do not have a label for the field the code will conveniently be exposed.

    Button to add a record

    The button for the Add would be something like this

    var text ADD = URLRoot() & "db/" & [_DBID_Travel_Request]

    & "?act=API_GenAddRecordForm"

    & "&_fid_10=Spanish"

    & "&dfid=11";

    var text Dashboard = URLRoot() & "db/" & AppID();

    $Add

    & "&rdr=" & URLEncode($Dashboard)

    You can try that button by clicking on the code it generates before trying it on the Dashboard as a URL.

    For the edit button which would be presents to the user as on the results of their search the button might be like this

    var text FormID=

    Case([Language],

    "Spanish","11",

    "French", "12",

    "English","2");

    var text Edit = URLRoot() & "db/" & [_DBID_Travel_Request]

    & "?a=er" & "&rid=" & [Record ID#]

    & "&dfid=" & $FormID;

    var text Dashboard = URLRoot() & "db/" & AppID();

    $Edit

    & "&rdr=" & URLEncode($Dashboard)

        

    If there are syntax errors or the buttons are not working, please post the actual code you are using as obviously this Forum input box is not able to check my formuals for syntax.



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 13.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 20 days ago

    note that I did an edit above

    & "&dfid=" & $FormID;



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 14.  RE: API_GenAddRecordForm & Dashboard Buttons Widget

    Posted 20 days ago

    sorry, I realized hat here was an error

    Button to add a record

    The button for the Add would be something like this

    var text ADD = URLRoot() & "db/" & [_DBID_Travel_Request]

    & "?act=API_GenAddRecordForm"

    & "&_fid_10=Spanish"

    & "&dfid=11";

    var text Dashboard = URLRoot() & "db/" & AppID();

    $Add

    & "&NextURL=" & URLEncode($Dashboard)

    You can try that button by clicking on the code it generates before trying it on the Dashboard as a URL.

    For the edit button which would be presents to the user as on the results of their search the button might be like this

    var text FormID=

    Case([Language],

    "Spanish","11",

    "French", "12",

    "English","2");

    var text Edit = URLRoot() & "db/" & [_DBID_Travel_Request]

    & "?a=er" & "&rid=" & [Record ID#]

    & "&dfid=" & $FormID;

    var text Dashboard = URLRoot() & "db/" & AppID();

    $Edit

    & "&NextURL=" & URLEncode($Dashboard)



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------