Forum Discussion
QuickBaseCoachD
7 years agoQrew Captain
What would you want to trigger copying records?
- MuraliGangineni7 years agoQrew CadetI want the trigger to be on click of a button. On clicking the button, delete all the records from the Table2 and copy the records from Table1 to Table2. Before copying, filter has to be applied on "Article Number" column in Table2 based on the Article number present in the record in some other table from where i am clicking the button. Copy only those filtered records.
I know we can use API_PurgeRecords to delete all the records in Table2. But i got stuck at how to copy the filtered records from Table1 to Table2. And that filter on Table1 should be dynamic filter as Article number changes from one record to another record from where i am clicking the button. - QuickBaseCoachD7 years agoQrew CaptainIf this just needs to work in a single concurrent user environment, you can set up a table with a single record and have a field there to hold the Focus Article Number. Then make a relationship to the detail records based on a reference field with a formula value of 1, and then then look that up down to the detail records.
Then, make a saved table to table import subject to the filer.
Then you would make a URL formula button which would do the following steps.
Write the Article number into the Focus table for record with Record ID# of 1. (As there only is one record there)
Purge table 2
Run the saved import.
Land the user somewhere, probably on table 2. - MuraliGangineni7 years agoQrew CadetThanks for the quick response,
I didn't understand how to achieve this thing "Make a saved table to table import subject to filter" and "Run the saved import" .
Can you please explain how to do that. - QuickBaseCoachD7 years agoQrew CaptainYou will need to set up a table called Focus Article and create 1 record. It will be Record ID# 1. Create a field to hold the Focus Article.
Make a relationship to your detail table where 1 Focus Article has many detail records. For the reference field on the right hand side, change the field type to be formula numeric with a formula of
1
Then lookup the focus article down to the detail records.
Then from any table home page or the dashboard go into import export and create an import "from another table" to populate table 2 from table 1.
Get that far and then post back. - MuraliGangineni7 years agoQrew CadetI have created the Saved Import.
_Now how can i run the saved import. Can i use any URL or something to run the saved import on the click of a button with URL. - QuickBaseCoachD7 years agoQrew CaptainCan you contact me at http://www.quickbasecoach.com/ and I will help you with the code?
- MuraliGangineni7 years agoQrew CadetI contacted you on http://www.quickbasecoach.com/. Please Check.
- QuickBaseCoachD7 years agoQrew CaptainOK, off like you said that you have some experience with URL formula buttons.
We will need to do four steps
1. Set the focus
2. Purge table 2
3. Run the saved import
4. Land the user somewhere
We will first set up the steps as formula variables and then put them together.
The button will reside on the Article record, so that the button knows what the focus Article is.
var text URLONE = urlroot() & "db/" & [DBID_Focus_Article] & "?act=API_EditRecord"
& "&rid=1"
& "&_fid_7=" & urlencode([Article])
& "&apptoken=xxxxxxx"; // if you have application tokens enabled every step which edits will need this line
var text URLTWO = urlroot() & "db/" & [_DBID_Table2] & "?a=GenPurge";
var text URLTHREE = urlroot() & "db/" & [_DBID_Table2] & "?act=API_RunImport&ID=10";
var text URLFOUR = urlroot() & "db/" & [_DBID_Table2] & "?a=q&qid=1;
$URLONE
& "&rdr=" & URLEncode($URLTWO)
& URLEncode("&rdr=" & URLEncode($URLTHREE))
& URLEncode(URLEncode("&rdr=" & URLEncode($URLFOUR)))
- MuraliGangineni7 years agoQrew CadetThank you very much..
- QuickBaseCoachD7 years agoQrew CaptainLet me know when you get it working :)