15 exact forms to be used in a single table

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

I have two tables - one Employee (parent) and one Training Details (child). The Training Details table has a Master Training Record that I will use to Copy the Master training details to new Employees - so far so good as this works fine.

Now to the details of my question ... the Training Details of the Master Training Records has Day 01 to Day 15 for a total of 15 training details/records. I have created a separate exact form for each day - lets call them Day 01 to Day 15 Training Document. 

When I create Day 01 Training Record in the Master Training Record, I'd like to be able to have a field entitled Training Document and choose the Day 01 to Day 15 Training Record exact form and have this displayed as a button. I'd prefer to not have to use Rules to accomplish this task. I am no good at JS, so that's out for me. I struggle through URL formulas but can muddle my way through with some effort (good training!).

When I loaded the Exact Forms for this table, all 15 are displayed on the Training Details form. This won't work as when the day is Day 01, I only want the Training Document for Day 01 to appear. 

Thanks again team QB! Much appreciated ... and Merry Xmas!

Photo of Andrew

Andrew

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,422 Points 50k badge 2x thumb
You should be able to just do a Case statement right?

Case([Day],
"01", [Print Exact form 1],
"02", [Print Exact form 2],
.
.
.
"15", [Print Exact form 15])

Let me know if that was the easy answer or if it more complicated than that.
Photo of Andrew

Andrew

  • 0 Points
Is this Mark? If so thanks ... and if not, thanks too!

Sort of works. If I use this in a Text Formula, I get the URL to the Exact Form page. It's a long URL, so this is not the best solution.

If I used this in a URL formula field, with no changes to the Case statement as indicate above, I can use a button. This is better, but now I want the button to display which Training Document will be displayed. I could rename the button as Training Document, but I'd like for it to display Training Document - Day 01, Training Document - Day 02, etc ...

Any ideas for this one? I have essentially accomplished this through form rules, but since I have a Report Link back to the Parent, the rules on the form don't work in the report link.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,422 Points 50k badge 2x thumb
Try this as a formula text field with HTML enabled

Not tested, but here goes.

var text Words = "Print Day " & [Day];

var text URL = [your current URL button with the Case formula];

"<a href=" & $URL & ">" & $Words & "</a>"
Photo of Andrew

Andrew

  • 0 Points
Mark, thank you! This is working. How do I get this to display on a button vs. a link on my form? I also need it to open in a separate window. I don't get this option with the text field.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,422 Points 50k badge 2x thumb
To get a new window to open you need to use the target = blank syntax.  The syntax is tricky.

var text Image = "<img src=https://gesco.quickbase.com/up/bbeevg2wq/g/rbz/eh/va/MSRPButton.png>";

"<a href=" & [Run MSRP Reports (URL)] &  " target=\"_blank\"" & ">" & $Image & "</a>"


To get a button to show instead of Words, you need to provide a link to an Image and store that image in a QuickBase Table accessible to your Users.  One way to make an image is to use the canned images that QuickBbase provides here https://www.quickbase.com/db/9kaw8phg?a=ShowPage&pageid=134 or you can make your own buttons using this free website tool here. http://dabuttonfactory.com/
Photo of Andrew

Andrew

  • 0 Points
Hello Mark -

Thank you. Got the new window to open, so good progress!

Now here is the issue I am trying to solve for and maybe I can't .... but here goes:

Below is my formula in a Text Formula field with HTML enabled:

var text Words = "Print Training Record - " & [Day #];

var text URL = Case([Day #],
"Day 01",[Print Day 1 - GRA Training],
"Day 02",[Print Day 2 - GRA Training]
.
.
.
"Day 15",[Print Day 15 - GRA Training]);

"<a href=" & $URL & " target=\"_blank\"" & ">" & $Words & "</a>"


A link displays on my form, and if I am printing for Day 02, the link displays Print Training Record - Day 02. Not a bad option for my users. The link description changes based on the day # chosen.

Ideally I'd like is to get the same result of the formula above, except not to display a link. Instead, display a dynamic button with a button description that changes with the day. For example, if the user is working on a training record for Day 01, I'd like the button to display Print Training Record - Day 01, and if they are on a training record for Day 02 I'd like the button to display Print Training Record - Day 02.

I can accomplish this with 15 different form rules and 15 different URL formulas. Not the best option if I can accomplish it through programming.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,422 Points 50k badge 2x thumb
In order to display as a button (as opposed to just the hyperlinked words link),  the only way I know of would be to actually make 15 button images each with a different words on them manually using the dabuttonfactory.com website.  Then you would adjust the formula to use the correct Image according to the Day.
Photo of Jack

Jack, Champion

  • 50 Points
Hi,

Sorry to chime in, but this seems a little clunky. There may be a really good reason for this but why not use one exact form which is setup to create the whole document day 1 - 15. Using relatively simple HTML (I.e page breaks) and a copy and pastable query you could generate the document on say one page for each day, you can also make extra pages appear conditionally based on a count of records for that group so for example if 10 records fit on one page for one day but a particular individual has 15 it would generate an additional page for the 5 records and add a header to each page stating which day it is. Let me know if this is something your interested in and I'll provide the links to the posts I have previously detailed it on.
Photo of Andrew

Andrew

  • 0 Points
Hi Jack .... since I am in testing mode I am interested in making it easier and not try to manage the 15 separate files when one of them undergoes a change! So yes, I am interested. I am a learner and don't have great skills here (but they are improving), so will need a little extra guidance in whatever you may send my way! Thanks again for the suggestion and your offer to share.
Photo of Jack

Jack, Champion

  • 50 Points
Hi Andrew,

Dont worry I'm still learning new things and I've been using QB for 3+ years, one thing I have learned is that there are many ways to do the same thing, some are better than others for specific needs or future needs, so your need/requirement is the ultimate guide as to which approach you take.

There are some really great experts/Quickbase partners on the forum such as Mark and Dan, I count myself as more of an experienced user/amateur developer. I hired a Quickbase partner to assist me when we built our first app and learned an awful lot from working with him, it was a fantastic experience and I assimilated an awful lot of knowledge. I think that exact forms are very much underused by many people and therefore knowledge/approaches/examples on exact forms is perhaps weaker than many other areas of Quickbase. This doesn't mean that you shouldn't try, it just means that it might take a little time. If you find good ways of doing things in exact forms, then post a question and answer it yourself with a good detailed answer as this will help others and improve the library of examples we have on the forum.

Take a look at this:

By using the combination of the below you could place records on different pages in an exact form, say a 15 page exact form with one training day per day, if you need more pages per day you can use conditional loading to insert extra pages based on a count of related records for day one. If for example 10 records fit per page but day 2 has 15 records this would generate the additional page with the 5 records and then carry on. Note with 15 pages it may take a few seconds longer to generate than usual on click of your button.

Conditional Loading of queries or fields on Exact forms:
https://quickbase-community.intuit.com/questions/929106-ever-wanted-to-make-your-exact-form-load-conditionally

Skp and num functions in queries on Exact forms to load tables conditionally by page generating a new page if sufficent records exist:
https://quickbase-community.intuit.com/questions/1076509-in-an-exact-form-can-i-use-a-javascript-if-statement-to-decide-if-i-want-a-page-break?jump_to=answer_2518455