Forum Discussion

SaudaFurkhana's avatar
SaudaFurkhana
Qrew Cadet
7 years ago

Button on Dashboard (HomePage) to invoke Await-Async JS code

Hi Dan,  

As advised, starting a new post on "how to configure a button on the home page to concatenate text from all the child records using await/async technique."  

Can you please share regarding this

1) Background on using  Await/Sync technique setup 
1) The iol field is placed on the parent record form to invoke the JS code. 
2) Theawait/async loops through the report on the child table. Child report contains two columns: Text Field (that needs to be concatenated), Record ID of the parent record. The report is sorted and grouped based on the record id of the parent. 
3) The code concatenates text from all the child records of a parent record, edits the parent record to set the concatenated text to a field.  

So, instead of placing the iol field on the parent record and seeing the "reload behavior", it is probably best to have it triggered via button on the home page.  

2) Performance: What do you think is causing the performance to degrade? - My child report has 1200+ records that belong to almost 1000+ parent records. Code is taking very long time to calculate the concatenated text. The code is not fast and the speed reduces gradually. It edited 50+ parent records in 2 hours!   

Thank you, and as your help and guidance is highly appreciated!

5 Replies

  • I would have to see the code you are currently using. Also, if this posts is referencing some other post or my reply I can't locate it quickly so you might want to post a URL to give me a context.

    If you are experiencing a delay of this magnitude it is probably because you are flooding a bunch of AJAX requests which launch immediately and the browser is running out of sockets. Again, I would have to see the code you are using but the whole purpose of using async/await is to mediate the AJAX requests one after the other to avoid running out of sockets.
  • Hi Dan,

    1) Reg. use of button on homepage - This is the post where we extensively discussed the issue with IOL techniques and it contains your suggestion (last but second post of yours) to trigger JS code using button on home page.


    In the first technique: saving the report does not save the "concatenated text" in the downloaded file, and then when applying filters on the report, the concatenated text field blanked out and the value was not recalculated

    So, you suggested the second technique of using await-async method. 

    2) I just edited your code to point to my tables and fields. Do you want me to grant you access to my application?

    Thanks,
    Sauda
  • Hi Dan,

    Happy New Year to you!

    Just checking in to see if you had the opportunity to look into this issue.

    Regards
    Sauda
  • My advice was to narrow your question down as it is overboard.

    "How to configure a button to run script is a separate consideration - ask about it in a new question."

    QuickBase does not provide a simple way to attach script to a button on the application dashboard. The buttons it does allow you to place on the dashboard do not run script but rather load the page specified by the URL. The easiest way to get a button on the application dashboard to run script is to place the button in a minimal report and place the report on the dashboard. The button can then be a formula URL using the JavaScript protocol or some type of formula rich text field which when clicked on will run the relevant script.

    Another simple approach is to create a simple HTML code page with the button and place the code page on the dashboard through a web page widget. This second approach requires you to write some simple type of HTML page with script mindful of the fact that the script will execute in the context of the containing <iframe> associated with the web page widget.

    Other techniques to add a button to the application dashboard would entail using BOL, SW or some other script injection technique to alter the application dashboard's native behavior.

    In many cases it isn't worth the effort of placing the button on the application dashboard itself but rather just create a new table called Tasks and include button in this table. Then place a report with all your Task buttons on the Tasks table homepage.

    Your further questions about using async/await or concatenating child records should be in their own thread.
  • Hi Dan,

    Reg. button: Ok, if you recommend table homepage button is not required then I will stick to the button on report then. Thank you.

    Reg. issue with my code: I will start a new thread. I will grant you access to my application to look at the issue I'm facing. Thank you.

    Thanks