Search Results for 'script'
Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Search › Search Results for 'script'
-
AuthorSearch Results
-
June 11, 2020 at 3:21 AM #40880
Topic: Ability to color rows in multi-columns?
in forum Using Tap Forms 5pierrot_rennes
ParticipantHi,
Is it possible to colorize the lines in multicolumn mode according to a check box?
A script?
I have a collection and I would like the row of a record to be colored if the check box is activated for each record
Or even better depending on a value 1 or 2 or 3 in a field, the color would be different
Unless there is another solution?Attachments:
You must be logged in to view attached files.June 10, 2020 at 6:13 PM #40873In reply to: Watched TV Shows
Sam Moffatt
ParticipantLooks like you’re missing the trailing slash. When I go to IMDB, it adds the slash for me and the regexp for the script is looking for the final slash. Try
https://www.imdb.com/title/tt0185906/instead.June 10, 2020 at 7:57 AM #40868In reply to: Watched TV Shows
pierrot_rennes
ParticipantHi,
I imported the Watched TV Show form but it doesn’t work.
Same problem as previous posts.
When we launch the script, it inserts a new recording only marked NO (example: the Band of Brothers file – https://www.imdb.com/title/tt0185906).
No information from the chosen TV show on IMDB
In the script, I put my IMDb Api key in quotes otherwise there is an error in the script.
When we launch the script, no file is inserted except a “No”
See my screenshots in case I made a mistake.
thank you in advanceAttachments:
You must be logged in to view attached files.June 9, 2020 at 10:36 PM #40863In reply to: Date form YYYY
Sam Moffatt
ParticipantYeah, I think it was added to Tap Forms 5.3 earlier this year. Tap Forms 3.5.20 is the much older version that is still available for folks who haven’t upgraded yet.
Tap Forms 5 added so many new features such as new CouchDB based replication (my favourite feature), support for scripting with Javascript and built in charting capabilities.
June 8, 2020 at 7:46 PM #40853In reply to: Time Zone Fun
Sam Moffatt
ParticipantTry changing the Z to be +07:00 or similar. Tap Forms internally stores the dates in UTC+0 but will convert to your local time zone. Alternatively use a form script to change the time but probably best to do during import.
June 3, 2020 at 11:31 PM #40795In reply to: Picklist in all forms
Sam Moffatt
ParticipantI don’t believe you could a single list, though if you put the states in a form you could export and re-import the form for each document. Each document is its own standalone document store without anything shared between documents. You could also potentially automate it with a script that pulled from a location and added/removed states.
June 3, 2020 at 5:08 PM #40791In reply to: Picklist in all forms
Chris Medeiros
ParticipantHey Wolfgang,
Okay. You’ve tapped out my expertise on the topic of Pick Lists. I cannot give you a definite yes or no. I suspect it’s no, but maybe there’s a script that can be written to accomplish your goal. I don’t know. Hopefully, someone with more Tap Forms experience will be able to supply you with a better answer.
I can think of a possible workaround. Do you have a form that contains a record for each Federal State? What if you export the records from your Federal States form, import it into your 2nd Document’s Form and then create a new Pick List in that Form using the “Use Values from field” option. Could that work?
May 31, 2020 at 8:01 PM #40749In reply to: Question about Pivot data design
Sam Moffatt
ParticipantYou could use a form script to create a pivot form and generate the data yourself. The API should have enough power to create a new form based on your current form and you’d just add fields yourself to an existing set of records.
May 31, 2020 at 5:49 PM #40748Topic: JavaScript API 5.3
in forum Using Tap Forms 5Rocky Machado
ParticipantHi Brendan – I have a couple of questions. Have the following methods been deprecated.
form.getRecordsForSearchTerm()andrecord.setRecordColor()It doesn’t show up in the IntelliSense. Also, in the future will you being adding a feature to recalculate a form via the javascript API?Oh, I’m running version 5.3.11 (Build 962)
thanks,
rockyMay 28, 2020 at 8:28 PM #40720In reply to: Auto create records with photos
Daniel Leu
ParticipantI would try something different: Save the image into a Dropbox folder, then have an AppleScript get the URL link and launch a Form script using the tapformz URL and use the shared link (and whatever else you need) as a parameter. Then in the Form script, you can create a new record, add data entries given via the parameter and fetch the image from the Dropbox link and attach it to the record.
I think this should work, but haven’t tried it!
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksMay 28, 2020 at 7:09 PM #40719In reply to: Auto create records with photos
Sam Moffatt
ParticipantWhen you enable the CouchDB integration, Tap Forms writes to the CouchDB server in Tap Forms’ own format and sync’s that with each of the devices that are connected to that server. You can get to that data using the standard HTTP REST interface that CouchDB exposes and do interesting things with it, that’s how my TF Tools repository on GitHub works to do stuff like backups, dump document structures and pump data to ElasticSearch for visualisation (before Brendan added charts natively). All of that code is in PHP rather than Javascript because PHP is a language I’ve done a lot of code in and is reasonably portable.
Since the CouchDB API is a standard open interface, we can see what the format is that Tap Forms is writing and whilst it’s a little opaque with the field names it’s not impossible understand the format. If we write data in the same format that Tap Forms is expecting, then Tap Forms will display the records and let you interact with them. As far as your Tap Forms app knows the record came from another instance of Tap Forms.
I’m working on another blog post on how I use Safari to scrape this forum as I navigate it with a Tampermonkey script that writes to CouchDB. I then use Tap Forms to do my own search of the forum and create custom saved searches. Follows a similar concept where I create the structure in Tap Forms and then create records matching the structure via CouchDB’s REST API using Tampermonkey. I have a few tricks around record ID generation to make sure I don’t import something more than once as I navigate around.
May 28, 2020 at 1:43 PM #40714In reply to: Auto create records with photos
Marc Reichert
ParticipantThank you for both of your answers!
@Brendan I will keep that in mind for other projects, but here I won’t be able to import the data in bulk, because the process should be streamlined like a production line. An artwork will be captured by one person while the other will then generate all the archival details needed, then it will brought into storage and the process starts again.
@Sam Moffatt I think I can follow your description and read your blog post but I’m not shure if I’m competent enough to modify your project to my own needs. Do I get this right that you directly inject database entries in the correct structure into the (sync)storage of TF which will then replicate to the local application data? I guess for the start we will go the manual way and create the records by hand and as it won’t be me hitting the select button some hundred times I’m not too bothered ;) But perhaps I could use this project to finally learn some JS programming.
May 27, 2020 at 7:22 PM #40711In reply to: Whether to use a script or a calculation?
Sam Moffatt
ParticipantYeah, function is another word for subroutine. I think the C folk went with function and that filtered down through that branch of the language tree. Etymology of language features is fun, subroutine, procedure, function, all roughly the same.
Ok, so welcome to the not so fun part of Javascript which is the amazing dearth of simple string formatting tools. This one has bothered me on and off for a while within Tap Forms but I’ve never had a good reason to figure it out. However I had another crack at something that might work but it’s a little awkward.
Coming from a C background there is a function called “sprintf” that formats a string. I found on GitHub a Javascript sprintf implementation and gave it a spin to see if it’d work. I did make one minor change and you can check it out on my own fork.
Copy that forked JavaScript file and create a new form script called “sprintf” and replace the placeholder text with the sprintf.js text (the link should take you to the raw version to easily copy).
Now for your use case where you want to embed, you should be able to use something like this:
form.runScriptNamed('sprintf'); payment_amount = 99.5; izettle_charge = 12.54; izettle_net_amount_received = payment_amount - izettle_charge; result = sprintf("Amount paid: £%0.2f\riZettle charge: £%0.2f\rNet amount received: £%0.2f", payment_amount, izettle_charge, izettle_net_amount_received);The
form.runScriptNamed('sprintf')pulls in the library and definessprintf(and alsovsprintffor good measure). You’ll need to update your script to add that line. Then you’ll have to change the formatting to use thesprintfstyle formatting. I put in a relatively simple use case ofsprintfwhich I think should give you the currency style formatting you’re after.sprintfuses percent signs as format markers so%0.2fsays format a floating point string with two decimal places. It’ll pad to two decimal places for you as well and expand on the integral side appropriately. If you need a literal percent sign, put in%%.I think that should get you further along with where you’re going.
May 27, 2020 at 2:23 AM #40707In reply to: Whether to use a script or a calculation?
Victor Warner
ParticipantSam,
Thank for the explanation of the use of a function. I guess it is similar to a sub-routine in AppleScript speak.
Concerning formatting. Do you mean in the Edit Field Script window changing the Result Type from Text to Number. If so, in this case – there is no output as the ‘return’ contains a mixture of quoted text and variables.
May 26, 2020 at 11:32 PM #40705Sam Moffatt
ParticipantGood to hear it worked out for you. One thing I forgot to mention is that once you have the script field working, you can set the field to be hidden so it doesn’t show up any more in the default layout. The Javascript integration gives you the ability to do some powerful stuff with Tap Forms though obviously with a slightly higher bar than a simple calculation field.
Just curious what made you make the leap from Ninox over to TF?
-
AuthorSearch Results