Discussions

Expand all | Collapse all

Requiring Field through Formula - URL button

  • 1.  Requiring Field through Formula - URL button

    Posted 02-05-2020 10:12
    Hey QB Community,
    I'm looking for some help...I'm using a formula url button to allow users to submit a record while in View mode. When clicked, the formula checks a Submitted checkbox as true. 
    I'm trying to require a numeric field to have a value if it is null when the button is pressed.
     
    1. I tried using a form rule "When [Submitted]=true and IsNull([Number]), require [Number]". The record saved without requiring [Number].
    2. I tried a formula in the custom data rules - If([Submitted]=true and IsNull([Number]), "Error Message.") I received the error message below when I did this.
     
    Both options worked when I opened the record in Edit mode and manually checked the 'Submitted' checkbox, without using the button. I assume it's because the button is checking Submitted at the same time I'm wanting it to see if there is a value in Number.
     
    An easy fix is to change the button to a multiple choice or checkbox. But I'm trying to make the button work.
     
    This was the error message...anyone know where I can find the definition of error codes?
     
    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <qdbapi>
    <action>API_EditRecord</action>
    <errcode>88</errcode>
    <errtext>Custom data rule failed</errtext>
    <errdetail>
    Custom data rule failed: Please enter a value into the Vacant Sq Ft Data Entry field. Enter '0' if there is no vacant sq ft.
    </errdetail>
    <rid>7994</rid>
    <num_fields_changed>0</num_fields_changed>
    <update_id/>
    </qdbapi>


    ------------------------------
    Heather Bryant
    ------------------------------


  • 2.  RE: Requiring Field through Formula - URL button

    Posted 02-05-2020 10:42
    Edited by Brandon Drake 02-05-2020 10:48
    Hello Heather, 

    Can you provide us with the code you have in the button? From what I can tell with the information provided is that you do not have a redirect in your button, so it performs the action and the rule is working, but since there is not a redirect, it just shows the XML response for the request.  If you do have a redirect, then there may be more to it.  One other potential option is to just edit the button itself.  If the required field is blank, then do not display the button, but display some text that that specific field is required. For example, if(isNull([Number]), "Number is Required", Button Formula).  Then if the number is null, there is not a button to press.  But if the number is present, then the button will appear and should work as expected.  Another option is to have two functions for the button, if the number is null, take the user to another small form that asks them to enter the required value, if the number is not null, then check the submitted box and move on.  These are just some ideas without seeing the whole process or the current button formula.

    Error codes can be found on the Quick Base API Guide page 357. https://help.quickbase.com/api-guide/quickbase_api_guide.pdf. However, it does not have code 88, but I would assume it is an error based on the fact that a form rule prevented the API from completing its task. 

    ------------------------------
    Brandon Drake
    JHI Group
    Monroeville OH
    ------------------------------



  • 3.  RE: Requiring Field through Formula - URL button

    Posted 02-05-2020 14:18
    Heather, the error message is saying

    Custom data rule failed: Please enter a value into the Vacant Sq Ft Data Entry field. Enter '0' if there is no vacant sq ft.

    So you have enabled Custom Data Rules in Advanced Properties for the table and the Custom Rule is triggering an error so the record is not saving.  You need to either disable / fix the custom data rule or else comply with it.

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