Discussions

Expand all | Collapse all

Help with formula URL

  • 1.  Help with formula URL

    Posted 06-09-2017 15:24
    I am using a formula URL field to complete a field using a button on the main view. I would also like this button to create a record in a child table and copy across a couple of fields when it is clicked. At the moment the formula is:
    var text url =

    URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken="appToken"&rid=" & [Record ID#] & "&_fid_41="&URLEncode("Sales Feedback");

    "javascript:" & "$.get('" & $url & "', function(){" & "location.reload();" &
        "});" & "void(0);"

    What would I need to do to add field ID's 10, 20, 30 to the new record on the child table, save and return to the original screen the button was pressed on? 

    Would also be nice to have a different color for the button as well. 

    Many Thanks
    _


  • 2.  RE: Help with formula URL

    Posted 06-09-2017 15:39
    The syntax for doing successive URL calls and then refreshing the page you were on is very difficult.

    The lower tech solution is to use this syntax

    var text $URLONE=
    URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken="appToken"&rid=" & [Record ID#] & "&_fid_41="&URLEncode("Sales Feedback");

    var text URLTWO = add the child record;

    var text URLTHREE = urlroot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];



    $URLONE 
    & "&rdr=" & URLEncode($URLTWO)
    & URLEncode("&rdr=" & URLEncode($URLTHREE))


  • 3.  RE: Help with formula URL

    Posted 06-26-2017 15:51
    HI, Struggling with the call to create the child record can you help?


  • 4.  RE: Help with formula URL

    Posted 06-26-2017 17:27
    Try this
    var text $URLONE=
    URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken="appToken"&rid=" & [Record ID#] & "&_fid_41="&URLEncode("Sales Feedback");


    var text URLTWO = URLRoot() & "db/" & [_DBID_of the child table found in advanced properties]
    & "?act=API_AddRecord"
    & "&_fid_xx=" & [Record ID#] // populate the field [related parent] with the record ID# of the parent you are sitting on
    & "&_fid_10=" & urlencode([field 1])
    & "&_fid_20=" & urlencode([field 2])
    & "&_fid_30=" & urlencode([field 3]);
    & "&apptoken="appToken";

    var text URLTHREE = urlroot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];

    $URLONE 
    & "&rdr=" & URLEncode($URLTWO)
    & URLEncode("&rdr=" & URLEncode($URLTHREE))

    Note that the normal way to "populate" a child record with data from the parent is to simply add a lookup field to the relationship, but maybe you have some unique requirements here.


  • 5.  RE: Help with formula URL

    Posted 06-27-2017 09:46

    Hi 

    The reason we are not using lookup fields is that we are trying to see how long a record is in a status.  So, we want a new child record each time the status is changed on the parent, having multiple entries in the child.

    Below I applied the field info to the formula you provided above, which doesnt work.  Any suggestions would be great as I am very new to QuickBase.

     

     Parent Fields

    �         [Record ID#] - fid 3

    �         [Current Status] - fid 41

     

    Child Fields

    �         [Record ID#] - fid 3

    �         [Status] - fid 16

     

    var text $URLONE=

    URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken="chusaq6stbw3jcg2den4fa2vq=" & [Record ID#] & "&_fid_41="&URLEncode("Sales Feedback");

     

     

    var text URLTWO = URLRoot() & "db/" & [_DBID_STATUS_LOG]

    & "?act=API_AddRecord"

    & "&_fid_3=" & [Record ID#] // populate the field [related parent] with the record ID# of the parent you are sitting on

    & "&_fid_16=" & urlencode([Current Status])

     

    & "&apptoken="chusaq6stbw3jcg2den4fa2vq";

     

    var text URLTHREE = urlroot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];

     

    $URLONE

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

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


  • 6.  RE: Help with formula URL

    Posted 06-27-2017 13:12
    I'm not quite sure what you mean by "which doesnt work".  I'm not understanding is you mean that there is a syntax error or the functionality is not what you want.

    But going back now to your real question is how to track the amount of time in each status, I have done that for another client recently, and it can be done but it's a bit complicated.  The issue is that you essentially need to populate a date/ time field for when the record is created, which is of course easy as that is simply the [Date Created],  but then you would have a button to edit that same record in another field to "stop it's clock".

    That would need some one on one coaching time to get that working.  Contact me via the information in my profile or at QuickBaseCoach.com for personal one on one assistance with this.

    It is also possible that something could be done with the new Actions, which are a new feature of Quick Base.  Maybe we could have the Action update the time elapsed in each Status.  That is another approach.