Discussions

Expand all | Collapse all

Button to add a dollar amount to a field

  • 1.  Button to add a dollar amount to a field

    Posted 07-27-2018 21:01
    Having issues trying to create a button in a new table to help add a specific dollar amount to an existing field in another table.

    Table 1 - Cost
    Vendor: XYZ
    Field: [freight] = $100

    Table 2 - increases
    field: [Increase amount] = $50
    Field: related vendor
    button to action the increase

    Essentially we would enter in an increase amount in Table 2 that pertains to a specific related vendor or where vendor = XYZ.  have a button in the table that will add the $50 increase to the [freight] in table 1.

    can't seem to wrap my head around how this would work or if this is even the best way of doing it.  Looking for some insight or feedback.



  • 2.  RE: Button to add a dollar amount to a field

    Posted 07-30-2018 18:09
    If Table 2 is related to Table 1, you could add a lookup field to Table 1 for the [Increase Amount]. Then it would just be a matter of adding another field to add [Freight] + [Increase Amount], for your final freight amount.

    I worry that if you add a button the button could be pressed multiple times and cause an incorrect amount. To avoid this would be more code that could be avoided with the above solution.

    If you really want a button, my suggestion would be to still add a new field to Table 1 for the increase amount (to be populated by the button) and a total freight field. Even if the button is pressed multiple times it would only override the existing increase value vs adding to it.

    URLRoot() & "db/" & [_DBID_TABLE_1] &
    "?a=API_EditRecord&" &
    "rid=" & [Related Record] &
    "&_fid_6=[Increase amount]" &
    "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & 
    "?a=dr&rid="& [Record ID#])

    Replace with your actual values:  [_DBID_TABLE_1] , [Related Record],_fid_6=[Increase amount]



  • 3.  RE: Button to add a dollar amount to a field

    Posted 07-30-2018 18:58
    Thanks - this helps a lot.  I agree with you with your concerns about the double click.  as the values are consistently changing I think your option of only overriding the existing increased amount will work well in my scenario.  Maybe I can look at seeing if the [increase amount] field can be logged somehow.  This might help as well.



  • 4.  RE: Button to add a dollar amount to a field

    Posted 08-07-2018 21:32
    The double click is a pain but instead of logging there is a method where I use rich text formula buttons and will create a delay variable such as this

    var number delay = 10;  // number of minutes to delay the next button from showing up

    Then put an if statement that will allow the button to appear after a specified amount of time.

    If( [Date Modified]+Minutes($Delay)<Now(),

    ACTION

    ,��)

    Here is a post I have on the buttons made with Rich Text Formulas

    https://community.quickbase.com/quickbase/topics/buttons-with-color-function-and-flexability






  • 5.  RE: Button to add a dollar amount to a field

    Posted 08-07-2018 21:39
    that's a great idea - even if its only for a couple seconds at least it will help stop the double click.  Thanks for the advice.