Link/button to open specific form

  • 5
  • 3
  • Question
  • Updated 2 years ago
  • Answered
I have a report that lists customers. When I choose a customer it brings up a form that has a ton of useful summary info about the customer brought in from many parts of the application (this is done with report links, charts, etc).

I would like to be able to insert buttons (or links) on other forms (in other tables) in the app so that when I am viewing a particular customer I can reference info for the customer by launching that useful summary form for that specific customer. Ideally the form with the summary customer info would open in another window so the user can easily reference info between that new window and the form they were working on (or at least open it in a new tab).

I assume this can be done with a formula url field but I am not clear on the code to use that calls the specific form I need and also ties to the customer of the record I am in at the time. Any thoughts would be appreciated.

Tony
Photo of TonyA1

TonyA1

  • 100 Points 100 badge 2x thumb

Posted 5 years ago

  • 5
  • 3
Photo of Mark_Shnier

Mark_Shnier

  • 590 Points 500 badge 2x thumb
no problem

here is the formula

urlroot() & "db/" & [_DBID_CUSTOMERS] & "?a=dr&dfid=XX&rid=" & [related customer]



You get the [DBID_CUSTOMERS] which is the name of your Customers table from the Advanced Settings for the table.

The dfid ("da form ID") is from the URL you see when you preview the form.

Then you need to either feed it the record id ("&rid=" & [the field containing the record id of the customer]) or else you can also feed it a key field instead ("&key=" & [my key field])
Photo of Jennifer Miller

Jennifer Miller

  • 74 Points
This works great, but to take it one step further, would there be a way to automatically call up the print function so that I could print using the specific form rather than just displaying the record using the specific form?  I have a form that includes a ton of information, but only certain information is needed when the record is printed.  I've created the form to use for printing and created the formula URL button using your suggestion below, but rather than just directing my user to a different form and then them having to choose "More" and "Print", it would flow a lot better if the formula URL button just pulled up the print function using the specific form for printing.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 68,688 Points 50k badge 2x thumb
Try this as a UIRL formula field

URLRoot() & "db/" & Dbid() & "?a=printr&dfid=14&rid=" & ToText([Record ID#])

This will print using form ID 14.
Photo of Jennifer Miller

Jennifer Miller

  • 74 Points
Works great!  Thanks Mark!  And thanks for the quick reply!
Photo of TonyA1

TonyA1

  • 100 Points 100 badge 2x thumb
Mark....thank you!  Works great!
Photo of Piriye

Piriye

  • 0 Points
Hi Mark, thanks for this explanation. How can I make the form to open in view mode. It currently opens in Edit mode?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,914 Points 50k badge 2x thumb
If its opening in edit mode then your formula must be having this

a=er  (which says "action = edit record")

instdwad of

a=dr (which says "action = display record")
Photo of Piriye

Piriye

  • 0 Points
Never mind Mark, I figured it out. Thanks.
Photo of Piriye

Piriye

  • 0 Points
Hi Mark, I just saw your email after posting the previous comment. Thank you much for your quick response and being of help to us.
Photo of Antonina

Antonina

  • 0 Points
Dear, how can I make the button sending to another from for the same table? Thanks a lot.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,914 Points 50k badge 2x thumb
Please post a new question.
Photo of Piriye

Piriye

  • 0 Points
locate the form ID (dfid) and insert it after the API_GEN.... as shown below using "##". you can find the form ID by going to settings/Forms of the child table.




API_GenAddRecordForm&dfid=##&.....

Hope this helps.
Photo of Antonina

Antonina

  • 0 Points
what if I need not to open form for Add Record, but rather to Edit Current record? Thanks for help
Photo of Piriye

Piriye

  • 0 Points
Hi, this is what i use - I have typed in CAPs all the fields you have to change in your formula.

"https://DOMAIN NAME/db/TABLE ID?a=nwr&dfid=FORM ID\n&_fid_RELATED FIELD ID IN PARENT TABLE=" & URLEncode ([ID OF KEY FIELD IN CHILD TABLE])
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,914 Points 50k badge 2x thumb
To edit a record th format is this

urlroot() & "db/" & dbid() & "?a=er&dfid=xx&rid=" & Totext([Record ID#])



where xx is the form ID#
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
I am trying to use the same approach but in my case I have two unrelated tables with one field in each that matches.  So tried the following but no luck. 

URLRoot() & "db/" & [_DBID_Customers]& "?a=dr&dfid=2&rid"& [Location No]=" &[Location No])
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
You have to know the Key field to find that is on the other table (i.e Record ID),  If [Location No] is not the key field you cannot go directly to the record, but rather you will have to do  query to find that [location no]


Syntax if Key field is [Location No]:

URLRoot() & "db/" & [_DBID_Customers]& "?a=dr
&dfid=2
&rid=URLEncode([Location No])
Syntax if needing a query:
URLRoot() & "db/" & [_DBID_Customers]& "?a=q&qid=1
&query={11.EX."&[Location No]&"}

(this is assuming your location fid in the new table is FID 11)
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks Matt. Location number is not a key field in both of these tables. I tried this as is by changing the FID but I am getting syntax error 'expected a valid expression after the "&". 

In this formula where is it matching the location number with the table I am calling from? 
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
What are your two DBIDs?  _DBID_Customers  & What?
What are the field IDs for the [Location No] on those two tables respectively?
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks,  One is _DBID_CUSTOMERS and the other is _DBID_STORE_MIRROR.  Field IDs are 40 and 8 respectively. 
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
From your Customer table you'd need a formula-URL field with the equations:

URLRoot() & "db/" & [_DBID_STORE_MIRROR] & "?a=q&query={8.EX."&[Location No]&"}"

From your store mirror it would be:

URLRoot() & "db/" & [_DBID_CUSTOMERS] & "?a=q&query={40.EX."&[Location No]&"}"

Notice you are clicking the button from one table, but searching for the match in the other table
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
For now I used the statement for store mirror and this works great but it only shows the relevant record listed as a report.  Any chance I could open a form? 
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
Only if the field you are using for the query is the key field.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Yes that is the issue. It is a key field in the table but not quite in the other. 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,914 Points 50k badge 2x thumb
Arshad,

If you are looking to launch a report, the. Build your perfect report and have an question for the missing information. Then build the link below and it will launch a report and answer its own question using data from the record that you are launching from.

Suppose your perfect report is qid=99

Urlroot() & "db/" & [_DBID_TABLE NAMEGOESHERE] & "?a=q&qid=99&nv=1&v0=" & [Location No]
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,914 Points 50k badge 2x thumb
If you are just looking to provide a link to a scored or records off a a record, you can just use a report link field. You do not need a relationship to have a report link field.
(Edited)
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks. I was merely giving an option to users to open another form for the specific record they are on.  Can this be achieved if two tables are not linked yet they have a common field? 
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
If that common field is the key field then you can send them directly to that record and that specific form.  If it is not the key field you will have to do the query and then load that record to that form (might have to be another formula button.
Hi Mark,

Is there a way to focus on a particular section after clicked on a button.

It means after perform some tasks in a button then, user should foucs on the desired function.

Thanks,

Gaurav
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
If they need to focus on One and ONLY One section, 
You can copy the form, and remove all other elements.

Then have the rdr send them to that form.  

*Keep in mind you will need a way for them to get back to the main form after completing the task.

**Also, keep in mind the more forms you get, the more maintenance that follows when things change.
Hi Mathew,

Thanks for your reply. Yeah. you are right. It will not make sense to create multiple forms. I am thinking as we do for back to top in HTML like <a href="#top">Go to top</a>

So, if I know the id of a section then, I can easily make a focus on it. But how to use it...

Thanks,
Gaurav
Mathew,

Can you please look at my above query?

Regards,
Gaurav
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
There are a few different techniques you can use to get this, the one I use I can't give away ;)

But, I'm sure Dan D has some version of the IOL technique that can give you a focused look.

Check here:
https://haversineconsulting.quickbase.com/db/bgcwm2m3z
Thank you Matthew.

Let me check and will update you. :)

Gaurav