Forum Discussion
ChayceDuncan2
7 years agoQrew Cadet
When you say last record id - can you elaborate? Are you doing an import of a parent record, then a second import of your children and then need to associate the children against that most recent parent record?
If yes - my first thought, if you're using doQuery to get the most recent parent, would be to query your parent table to sort your doQuery in descending order of record id (meaning that you are returning the newest record id's first) and then set an option parameter for number of records to be 1 - so you only return the most recent record. You can parse that for the record ID and and associate it before you import the children
Chayce Duncan | Technical Lead
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base
If yes - my first thought, if you're using doQuery to get the most recent parent, would be to query your parent table to sort your doQuery in descending order of record id (meaning that you are returning the newest record id's first) and then set an option parameter for number of records to be 1 - so you only return the most recent record. You can parse that for the record ID and and associate it before you import the children
Chayce Duncan | Technical Lead
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base
ChayceDuncan2
7 years agoQrew Cadet
If your intent is to chain the actions together - meaning you create the parent, then within the same process also upload the second file without any kind of manual intervention - you will need 1 of 2 things to happen
1) Depending on how you are creating the parent record - the Quick Base API returns its XML response after an AddRecord - and you can parse that to get the RID of the parent record and then append that to your second import
2) Query Quick Base to find the parent record that was just created, and parse the query results to get the RID value you're looking for and append that to your second import
If you're using SQL - I'm not really familiar of how to use it with Quick Base, but I would imagine you could do something along the lines of:
Step 1: Update parent_table to create your parent record
After this completes -
Step 2: SELECT parent_table and get your recently created parent
After this is returned or however you would do the above
Step 3: UPDATE child_table , using one of your column = value entries set to the response in Step 2
My advanced SQL is pretty non-existent, but I could give a better client side (JS) example if that would help the understanding.
Chayce Duncan | Technical Lead
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base
1) Depending on how you are creating the parent record - the Quick Base API returns its XML response after an AddRecord - and you can parse that to get the RID of the parent record and then append that to your second import
2) Query Quick Base to find the parent record that was just created, and parse the query results to get the RID value you're looking for and append that to your second import
If you're using SQL - I'm not really familiar of how to use it with Quick Base, but I would imagine you could do something along the lines of:
Step 1: Update parent_table to create your parent record
After this completes -
Step 2: SELECT parent_table and get your recently created parent
After this is returned or however you would do the above
Step 3: UPDATE child_table , using one of your column = value entries set to the response in Step 2
My advanced SQL is pretty non-existent, but I could give a better client side (JS) example if that would help the understanding.
Chayce Duncan | Technical Lead
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base