Search Results for 'script'
Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Search › Search Results for 'script'
-
AuthorSearch Results
-
Vera Milosavich
ParticipantCan I get help with the Child Records Loop snippet — or whatever it takes to generate my invoices & summary reports? I have zero clue how to use javascript.
May 8, 2020 at 1:07 PM #40524In reply to: Add to Calendar
Alejandro
ParticipantHI Brendan!
thank you!
I’m going to store the eventID in other fields of that form. Is like A600F804-4729-48FC-906B-E85ED7ACC874:117BCA7E-0500-457C-A101-DB830C1E3EE0My idea is to have a special calendar for TF, and create events every time I see a Movie for example.
Then I can Visualise on my calendar when I saw movies. And also I add the link like:
tapformz://record/view/db-d604320e10394cd582b9b345b76a8f97/frm-b1e2b68a569c4dbe9e468c31f3a62188/rec-XXXXXXXXXXX
to get the details.But If I need to reset my calendar I want to delete all days for example.
By the way, is there a way to run a script and the output (like console.log) save it to a file?
Kind regards
AlejandroMay 7, 2020 at 10:14 AM #40516In reply to: formula showing sum of all records
Daniel Leu
ParticipantNow I see it….
Brendan, double-clicking on ‘Get total of field from form’ snippet returns
`var field-name_id = ‘field-id’;
var total = form.getTotalOfField(field-name_id);1But the
-is not a valid character to be used in a Javascript variable name.The same applies to the other three
Get...snippets.Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksMay 7, 2020 at 8:54 AM #40514In reply to: formula showing sum of all records
Wolfgang
ParticipantHi Daniel,
that’s exactly what I wanted to say.
In Tap Forms in the script field the variable of the formula “get total of field from form” is displayed with “-” and always gave me an error message.
That’s why I removed the “-” and used “fieldname” or “field_name” …May 7, 2020 at 2:04 AM #40507In reply to: formula showing sum of all records
Brendan
KeymasterOk, well that should work.
And sorry, for some reason I didn’t see your attachments before.
Did you return the values later on in your script? Or did you just define the vars?
May 7, 2020 at 1:33 AM #40501In reply to: formula showing sum of all records
Brendan
KeymasterCan you post your script?
May 7, 2020 at 1:24 AM #40498In reply to: formula showing sum of all records
Wolfgang
ParticipantThank you for the info. But no result is shown …
I use 2 field scripts (see screenshots).
– one with the line you mentioned above
– one using the formula of the list in the script window
No entries in the fields!Wolfgang
Attachments:
You must be logged in to view attached files.Brendan
KeymasterHi Vera,
Ya, building a layout system that handles a fully customizable rows with grouping and summarizing is a ton of work. It is something I want to eventually do though.
Tap Forms can do multi-page reports by linking custom layouts together. But each custom layout can only be one page tall. But that does allow you to have lots of fields with complex layouts spread over multiple pages per record.
You could actually write a script that generated the summary data for you from your Link to Form (or Table) fields. You could even use a separate Table field to store the summary records and use that on your Invoice. So your Invoice could have the Table field (or Link to Form field) with all the details, plus a separate Table field to store the summary results.
You would have to use the Child Records Loop snippet as Sam suggested to loop through your child records accumulating a total for a field. I should really add the
getTotalOfField()function to the record object so you could ask a Table field for a total of a specific sub-field.May 6, 2020 at 8:33 PM #40495In reply to: formula showing sum of all records
Brendan
KeymasterHi Wolfgang,
Sure. You can get that.
In the JavaScript API docs there’s this function:
var total = form.getTotalOfField(field_id);That’ll do it. It returns the same value as you see displayed at the bottom of the records list view.
Hope that’s what you’re looking for.
Thanks!
Brendan
Sam Moffatt
ParticipantAssuming you’ve set up your invoices with a link to form or table field in them for the individual line items, you can generate a script field that calculate what you need. The “Child records loop” snippet is a good place to start, you can use that to get the values of the child records and do what ever calculation you need.
I think one of the areas that Tap Forms is a little limited in is the reporting functionality with respect to nested elements. The custom layouts work well for single records and setting up simple labels but when it comes to building a single layout that could flow to multiple pages naturally based on child content, that just isn’t a thing. Getting something like that right in a generic sense is hard and would require building a new layout engine from scratch, it’s not the sort of thing I’ve seen outside of the expensive databasing products. I’ve spent a lot of quality time with page layout platforms and it can quickly get out of hand when you start to drill down into formatting, fitting items on pages, how you handle overflowing subcontent (e.g. should a child record be split apart or should it always be together?) and issues around odd/even page formatting. Very quickly printing things becomes…interesting.
Vera Milosavich
ParticipantBTW: I did NOT mean to imply TapForms is NOT excellent. So far it is the best of the home- and small-business use database I’ve tried. But summaries are critical for me.
Maybe I’m approaching summaries in the wrong way…
I’m still trying to figure out how a lot of the fields and properties work. Is there a way to create a separate field that can display a sum based on matching criteria, like SUMIF() and SUMIFS() in Excel or Numbers? If you could implement those kinds of formulas, my problem might be solved!
Or is it possible to collapse the line items of a summary when displayed on another invoice — or even in the spreadsheet view because sometimes I really ONLY want to see the subtotals and not every transaction.
Or is there a way to copy/paste group summaries so I can paste them into an invoice? It would be clunky, but it’s better than typing it in.
Is any of this something a script can do NOW? If so, maybe I can get help with that down the line. I’m not excited to learn scripting, but if I can solve this one problem, I think I’ll be over the transition hump.
Thanks!
May 5, 2020 at 11:17 AM #40479Topic: Humble Bundle Sale: Javascript Definitive Guide
in forum Script TalkSam Moffatt
ParticipantJust thought I’d post over here that Humble Bundle currently have a sale a selection of books from the O’Reilly Definitive Guide series. At the $1 tier is the Javascript book and I know folks have mentioned wanting to pick up more Javascript. I’ve not personally read this book but in general I’ve found O’Reilly’s books to be well written and I have a good selection of their books. At a dollar, that also helps charity too, I think it is at least worth a look to see.
May 5, 2020 at 1:51 AM #40474In reply to: Compound calculations?
Vera Milosavich
ParticipantThank you for the info. I did look through the manual but either I overlooked that or misunderstood the use.
I have no doubt that scripts can do much more, but I can’t devote the amount of time to learning this for just a handful of uses.
May 5, 2020 at 12:57 AM #40468In reply to: how to use dateadd in a script
Brendan
KeymasterHi Rainer,
Take a look at your post above again. I added the `
code` back ticks to show you what your script looks like formatted nicely. Sam and Daniel were just trying to help so that it’s easier to read your code.Here’s an example of a single line piece of code with back ticks:
var first_name_id = 'fld-......';and here’s a multi-line one:
var first_name_id = fld-.....'; var first_name = record.getFieldValue(first_name_id);We’re all here to help and share ideas.
Thanks,
Brendan
May 5, 2020 at 12:32 AM #40462In reply to: Compound calculations?
Brendan
KeymasterHi Vera,
With an IF() expression, you can use
&for AND and~for OR.so
IF((A=B ~ C=D & E=F); X; Y)The operators are mentioned in the Calculations topic in the online user manual:
https://www.tapforms.com/help-mac/5.3/en/topic/calculation
But for complex operations I usually prefer to use a Script Field instead of a Calculation Field. You can do so much more with Script Fields.
-
AuthorSearch Results