HimanshuSharma
4 years agoQrew Trainee
Sequential Operations in Formula fields.
Hello,
This post is regarding the future behavior of Formula fields.
Often we need to perform sequential operations using the Quickbase API's(API_EditRecord, API_PurgeRecords etc). In some requirements we often need to perform the 2nd API call only after the 1st one has completed, since JavaScript is going to be prohibited anywhere other than QB code pages we would need another way to perform such an operation.
An example of this kind of operation:
This is the code of field type "URL (formula)" which shows as a button.
In the above example $url_2 has to be carried out only when $url_1 has finished, jQuery get method allows us to do nested calls. The get method of $url_2 is invoked only after the callback function of $url_1 is called.
This will be a helpful way in many scenarios.
------------------------------
Himanshu Sharma
------------------------------
This post is regarding the future behavior of Formula fields.
Often we need to perform sequential operations using the Quickbase API's(API_EditRecord, API_PurgeRecords etc). In some requirements we often need to perform the 2nd API call only after the 1st one has completed, since JavaScript is going to be prohibited anywhere other than QB code pages we would need another way to perform such an operation.
An example of this kind of operation:
This is the code of field type "URL (formula)" which shows as a button.
var text url_1 =
URLRoot() & "db/" &Dbid()& "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=xxxxxxxxxx" &
"&_fid_9987=" & [Current User];
var text url_2 =
URLRoot() & "db/" &Dbid()& "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=xxxxxxxxxx" &
"&_fid_889=clear";
If([Prod Status]="Done",
"javascript:" & "$.get('" & $url_1 & "',\nfunction(){" &"$.get('" & $url_2 & "');"&"});\n"&"void(0);"
,null) //Using the jQuery "get" method.
In the above example $url_2 has to be carried out only when $url_1 has finished, jQuery get method allows us to do nested calls. The get method of $url_2 is invoked only after the callback function of $url_1 is called.
This will be a helpful way in many scenarios.
------------------------------
Himanshu Sharma
------------------------------