How do I make my formula-URL link to a specific field on a new table?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

I've created a button to take me from a record on one table to the related record on another table. This is the formula I am using and it works.

URLRoot() & "db/" & [_DBID_PRODUCTS] & "?a=er&rid="& [Item Code]

Is there a way to now direct the above to a specific field on the new table? In this case a specific field on the PRODUCTS table.

Photo of Andrea

Andrea

  • 90 Points 75 badge 2x thumb

Posted 4 years ago

  • 0
  • 1
Photo of Andrea

Andrea

  • 90 Points 75 badge 2x thumb
Also, I've selected that this button opens in a new window. It actually opens in a new tab. Is there a way to specify new window vs new tab? I'd like to be able to edit this other product record without leaving the original task.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
I will answer your first question.  I don't think that there is a way or at least not an easy way to position to have the actual cursor go to a field.  But there is a way, (courtesy of Dan Diebolt) say on a long form,  to position the screen to roll down to close to where you need to edit or view.

If you add this to the end of your URL formula

#JumpTarget

 like 

URLRoot() & "db/" & [_DBID_PRODUCTS] & "?a=er&rid="& [Item Code] & "#JumpTarget"



and then down near where you want the screen to roll down yo you put this as a formula text with html enabled (checkbox)



"<a name=JumpTarget></a>"


it should roll the screen down for you.  You may need to fiddle with where you put that field on the form.  Once you get it right, you can hide the field name by using an Alternate Description of (blank).

The label does not need to be called JumpTarget - it can be called anything, say bananas, but I recall that it is case sensitive as to how you refer to it in the URL and its name in the formulas and I avoid the use of spaces and special characters when I use it.

As for the new window, I don't know if that is possible - I doubt it. The code below could work to make a big X close button though so the users would close that new tab when they are done.







var text URL = "JavaScript:window.open('','_parent','');window.close();";

var text Image = "h t t p s://images.quickbase.com/si/48/832-close.png>";

 "<a href=" & $URL & ">" & $Image & "</a>"

(remove the spaces from the h t t p)







Photo of Andrea

Andrea

  • 90 Points 75 badge 2x thumb
Thank you! Do you know if it's possible to tell the record to save before the button jumps to the new target on the related table?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
No, I don't. If you want an answer, if there is one, you would need to post a new clear question, as I'm not actually sure I understand the question as to your desired workflow.
Photo of Andrea

Andrea

  • 90 Points 75 badge 2x thumb
Here was my initial dilemma:
I've created a button to take me from a record on one table to the related record on another table. This is the formula I am using and it works.
URLRoot() & "db/" & [_DBID_PRODUCTS] & "?a=er&rid="& [Item Code]
Is there a way to now direct the above to a specific field on the new table? In this case a specific field on the PRODUCTS table.

Here was the solution:
If you add this to the end of your URL formula
#JumpTarget
 like
URLRoot() & "db/" & [_DBID_PRODUCTS] & "?a=er&rid="& [Item Code] & "#JumpTarget"
and then down near where you want the screen to roll down yo you put this as a formula text with html enabled (checkbox)
"<a name=JumpTarget></a>"
it should roll the screen down for you.

This solution worked. However, when you click on the button/formula-URL it takes you to the desired location on the related table but it does not save the record first. Is there a way to change this formula
URLRoot() & "db/" & [_DBID_PRODUCTS] & "?a=er&rid="& [Item Code]
to include instruction to save before leaving the page?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
If you have dirtied (made unsaved changes)  the original record before you click that URL button you will get a pop up asking the user if they want to save before navigating away from the record.  But there is not an easy way to auto save when using that button.  

QuickBase did recently have an enhancement to allow the user to add a child record and auto save the parent.  Thats is a setting on the Advanced Settings for the table.  You can try checking that box, but I do not believe it will help for the URL button you have created.
Photo of Andrea

Andrea

  • 90 Points 75 badge 2x thumb
Thanks. I also thought that it would ask if I wanted to save before navigating away from the record but it does not. We will continue to look for an alternate solution.
Also, you are correct that the check box to auto save the parent record before adding the child record doesn't help in this case but I applied it to other tables and it saves me a step there instead. Thanks again!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
It will definately ask to save before navigating away if you have dirtied the record and do not open a new window with the button.  Uncheck that box on the button field settings. (open new windows ...) and then it will work.