Forum Discussion
SaudaFurkhana
8 years agoQrew Cadet
Hi Dan,
Thank you for the inputs. I got the new code working too and have few questions and need your guidance.
1) "My code queried all child records using {qid: 6} for simplicity of the demo."
Oh, my mistake! It was my oversight to read "qid" as "query".
My report in child table has "ask user" field to specify the parent record id. I hard coded the parent record id to test the code.
$.get(dbidActors, {
act: "API_DoQuery",
qid:"1000084",
nv:"1",
v0:"7524"
})
>>>> The concatenated text is appearing in the parent record. However, the code is looping and the execution does not break!
Meaning, in the every iteration, the output is calculated twice for each delimiter. And
This looping behavior is seen in both the "view mode" of the record#7524 and on the parent table report that contains #7524. Why is the execution not stopping when the concatenated text is displayed for #7524 the first time?
>>>> I stopped the execution after 12 iterations, please see the log file. For 12 iterations, we have output text calculated 24 times?
Please see the txt file the log output
Here is the screenshot of the output displayed in parent record and parent table report.
2) My parent and child tables have 10,000+ records each so I think I will have to execute the code for specific parent record ids ONLY and I'm not sure how to pass the parent record id or ids dynamically in the JS doquery code that uses qid (that is, a report). Can you give me some input on this?
Should I use the following code to extract the list of parent record identifiers (rids) and loop (using "for" or "._chain") through it using v0:rids in DoQuery?
var rids = $("div.QBU_Childs").map(function() {
return this.dataset.rid;
}).get();
3) "It shows up when I run the script anew"
- Can you please clarify what you mean by "run the script anew"? Movies table home page only has the concatenated text field (_fid_12). I don't see the formula text field that invokes the script. How did you run the script for all the records in parent table for the home page to reflect the new concatenated text?
Thanks
Sauda
Thank you for the inputs. I got the new code working too and have few questions and need your guidance.
1) "My code queried all child records using {qid: 6} for simplicity of the demo."
Oh, my mistake! It was my oversight to read "qid" as "query".
My report in child table has "ask user" field to specify the parent record id. I hard coded the parent record id to test the code.
$.get(dbidActors, {
act: "API_DoQuery",
qid:"1000084",
nv:"1",
v0:"7524"
})
>>>> The concatenated text is appearing in the parent record. However, the code is looping and the execution does not break!
Meaning, in the every iteration, the output is calculated twice for each delimiter. And
This looping behavior is seen in both the "view mode" of the record#7524 and on the parent table report that contains #7524. Why is the execution not stopping when the concatenated text is displayed for #7524 the first time?
>>>> I stopped the execution after 12 iterations, please see the log file. For 12 iterations, we have output text calculated 24 times?
Please see the txt file the log output
Here is the screenshot of the output displayed in parent record and parent table report.
2) My parent and child tables have 10,000+ records each so I think I will have to execute the code for specific parent record ids ONLY and I'm not sure how to pass the parent record id or ids dynamically in the JS doquery code that uses qid (that is, a report). Can you give me some input on this?
Should I use the following code to extract the list of parent record identifiers (rids) and loop (using "for" or "._chain") through it using v0:rids in DoQuery?
var rids = $("div.QBU_Childs").map(function() {
return this.dataset.rid;
}).get();
3) "It shows up when I run the script anew"
- Can you please clarify what you mean by "run the script anew"? Movies table home page only has the concatenated text field (_fid_12). I don't see the formula text field that invokes the script. How did you run the script for all the records in parent table for the home page to reflect the new concatenated text?
Thanks
Sauda
- _anomDiebolt_8 years agoQrew Elite1) "My code queried all child records using {qid: 6} for simplicity of the demo."
... My report in child table has "ask user" ... the code is looping and the execution does not break!
I can't debug this without seeing your exact code. Also, please don't run your "development code" against my demo as I don't want to have to come back and fix it or restore it to the original state. Some of my demos allow a user to add, edit or even delete records to show off the intended functionality and I don't mind small edits such as creating the "Test" actors. But you should create your own application mimicking mine and run your development code and modifications in your own application. It is a challenge creating public demos that use script when there are modifications to an application or deep workarounds.
2) I'm not sure how to pass the parent record id or ids dynamically in the JS doquery code that uses qid (that is, a report). Can you give me some input on this?
You can pass any number of parameters to process() to generalize what the async function does:async function process(qid) {
3) "It shows up when I run the script anew" Can you please clarify what you mean by "run the script anew"? Movies table home page only has the concatenated text field (_fid_12). I don't see the formula text field that invokes the script.
// definition of async function
}
var qid=7;
process(qid);
QuickBase does not have a "concatenate to parent" summary field so this thread (and the prior one) offered workarounds using script. The script has to be run immediately prior to viewing the report as child records may have changed since last viewing the report. So you have to get the scrip to run before viewing the report. This means you probably have to bind the script to a button but I have no idea where you want to place that button as that is a workflow issue unique to how you want to perform your task. Without any mention of your intended workflow I simply started the process from the console by pasting the script.
Undoubtedly you have to place the button (1) on the dashboard, {2) on some fake parent record (3) on a Tasks table record, (4) on some other parent record or perhaps even (5) on a code page.
How to configure a button to run script is a separate consideration - ask about it in a new question. The forum is a better resource for everyone if you ask simple questions that stand on their own, eliminate unnecessary details, and avoid long wandering threads.