Search Results for 'script'
Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Search › Search Results for 'script'
-
AuthorSearch Results
-
March 28, 2020 at 12:51 PM #40080
In reply to: IOS script bug
Abdullah AlQaseer
Participant1 thing more , printing the record in ipad doesnt seem to populate the script fields (even if they are already filled by refreshing the record )
Attachments:
You must be logged in to view attached files.March 28, 2020 at 12:40 PM #40079In reply to: IOS script bug
Abdullah AlQaseer
Participantclosing and opening the document didn’t fix the issue
I created the script on the Mac
refreshing the record populated the missing fields , but this way I have to do it for every record I create using the iPad
March 28, 2020 at 12:20 PM #40078In reply to: Script: Trigger new entry in child form or table
Sam Moffatt
ParticipantIf you check out my GitHub there is a tftools GIT repo with a number of PHP scripts that should run on any recent Mac (tested on High Sierra, semi frequently on Mojave and also on Ubuntu 18.04 with PHP 7.2). There are two backup tools, the first is a simple polling operation that grabs records as they change at the polling interval and the other one of those is a backup tool that uses CouchDB’s revisioning properties to try to retrieve all changes. You can use eithre to get a copy of almost all changes (assuming sufficient polling interval) made to a Tap Forms document. I generally use the simple one with an hourly snapshot interval. Caveat is you need to enable sync to CouchDB for it to work properly but beyond that it is stable (in theory you might be able to skip the CouchDB requirement but you’d have to track down the sync port from Tap Forms each time you open a document). I personally use it to keep an extra backup copy that let’s me also look back into time to pull back stuff that I break. Downside of this is that it’s all inaccessible from Tap Forms, you’d need some sort of bridge web service to get at that data from a script inside of Tap Forms.
If you wanted the data to be accessible inside of Tap Forms, you could create a second form within Tap Forms to store the changes. You would need to store a shadow copy of the record with the old values and you would need another form for your log with just the differences. The shadow copy could be an exact replica of your base form but that would be a pain to keep in sync and would result in a duplicate form for each form tracked. That’d be a little expensive but does have the advantage that you could debug it reasonably easily because Tap Forms would render the shadow copy. That leaves you with a form that would store a serialised copy of the records in a simpler form which would have the advantage that you could store what ever you need (curiously at that point you’re recreating a database like CouchbaseLite on top of Tap Forms which is running on CouchbaseLite). You need the shadow copy because Tap Forms doesn’t maintain the earlier copy so you need to do so to get the old version of the record. From there you could use field scripts to monitor all fields, deserialise the shadow copy, compare all of the fields, update the shadow copy with the new values that have changed and then persist the change to a logging form. The logging form I could see as having fields for Form ID and Name, the Field ID and Name, a field for a serialised copy of the old value and a field for a serialised copy of the new value.
You could leverage an external set of tooling to also write back into the CouchDB the change log and maintain the shadow copy outside of the Tap Forms database. That might make sense to be able to aggregate a number of related edits together into a single logical change because without the edit/save button enabled, every edit is automatically persisted and replicated to CouchDB (this is, in general, a good thing). This would remove the need to have a field scripts inside of Tap Forms to duplicate the data but would mean you’d be reliant on that infrastructure working.
March 28, 2020 at 12:14 PM #40077In reply to: IOS script bug
Sam Moffatt
ParticipantTry closing the document and opening it up again.
Where did you create the script? On the iPad or on the Mac?
Did you try refreshing the record on the iPad? If you drag down from the top of the record it should let you refresh the record and force all script and calc fields to be recalculated/executed.
March 28, 2020 at 6:17 AM #40069Topic: IOS script bug
in forum Using Tap Forms 5Abdullah AlQaseer
ParticipantI noticed that the script of a field only run in the mac app
when I create a record in ipad the script is not running (the script get the name of parent record)
I attached screenshot of record created in MAc and another in ipad app
note patient name and mrn are empty in iosI also attached screenshot of the script
any solution ?
Attachments:
You must be logged in to view attached files.March 27, 2020 at 11:50 PM #40064In reply to: Script: Trigger new entry in child form or table
Chris Ju
ParticipantThank you Sam for your contribution. I tried your scripts (Form Logger, Logger, etc.) and came up with the following idea:
Instead of historical values (by triggering new entries), the old and new values could be written to a log file (ideally on a log server), e.g.: modification date / form name / field / deviceName / old value / new value …
In the case that nothing is changed, log entry should not be made.
Do you think that would be possible?
Thanks
Chris(I’m unfortunately an absolute beginner in scripting, so your help would be really great …)
March 27, 2020 at 5:06 PM #40060In reply to: Script: Trigger new entry in child form or table
Sam Moffatt
ParticipantA thing I thought about a while back for detecting the change is to create a script that watches just one field each and referred to itself to detect changes to the field. Then you can use
runScriptNamewith some variables set already to have a common form script to handle the specific logic you need. That was only for fields in the same form, I’m not sure how well it’d work with table/child records propagating to the parent records but I think it should work for detecting changes within the same form. You could use something similar to call into the parent from the child for a link to form case, I’ve not spent as much time with table fields to know if that’d work.An example of a script field that refers to itself to retain historic state is in my checkbox flip flop script.
March 27, 2020 at 1:16 AM #40046In reply to: Script: Trigger new entry in child form or table
Brendan
KeymasterCalling
var field_1 = record.getFieldValue(field_1);will get you the value for field_1. That’s how you watch for the value of a field. You would have to list every field in your form like that in the script to watch them all.I understand what you’re wanting to do. But Tap Forms wouldn’t tell you which field was just edited. For every field you watch, Tap Forms would just give you its current value. Then you’d have to log that to your Table field or Link to Form field.
March 27, 2020 at 12:41 AM #40045In reply to: Script: Trigger new entry in child form or table
Chris Ju
ParticipantThanks, Brendan.
Add a Field Script to your form that watches for the value of another field that you’re wanting to change.
Can i watch all fields and if one was changed get the field name to pass on to the new entry in the child form?
(I hope it’s understandable ;-)
Thanks,
ChrisMarch 26, 2020 at 11:57 PM #40044In reply to: Script: Trigger new entry in child form or table
Brendan
KeymasterHi Chris,
Sure, you can do this.
Add a Field Script to your form that watches for the value of another field that you’re wanting to change. Then call the
record.addRecordToField(someRecord, field_id);function to add a record to your Table or Link to Form field.You’ll have to create the
someRecordrecord first, then populate it with your values, then call the above function.Then call
form.saveAllChanges();Thanks!
Brendan
March 26, 2020 at 11:41 PM #40041Topic: Script: Trigger new entry in child form or table
in forum Script TalkChris Ju
ParticipantHello everybody,
is it possible to trigger a new entry in a child form (or table) by changing any field in the parent form?
Then it would be ideal if the old value of the changed field could be transferred to the newly created entry in the child form (or table).
The aim is to track changes and preserve historical values.
Thanks in advance
ChrisMarch 26, 2020 at 4:06 AM #40024In reply to: Batch processing timefield
Hans
ParticipantThanks for your solutions. I’m not (yet) familiar with the scripting function so I tried the tip from Wolfgang first. Made a calculationfield and that gives the right time bij subtracting the 6 hours from the original timefield. Unfortunately the calculation fieldtype only has text, numeric and date layout, so there my plan gets stuck already.
I think I’m going to put my question in the Script-forum.March 25, 2020 at 6:58 PM #40013In reply to: change the text color of a field?
Brendan
KeymasterHi Wolfgang,
There’s no function to change the label colour from a Calculation field formula.
However you could do it from a Script field. And however again, changing the
lableColourproperty on the field will change it for all records though.If you enable the
Required Fieldoption on your field, then if a value is not provided, the field label will show in red automatically.March 25, 2020 at 11:32 AM #39999In reply to: Batch processing timefield
Brendan
KeymasterYes, this is one way to do it.
Another would be to write a Form Script that loops through all of the records, reading the value from the field, subtracting the 6 hours and setting the value back again on the field and then calling
form.saveAllChanges();March 19, 2020 at 12:20 PM #39933In reply to: iPad/iPhone form layouts
Sam Moffatt
ParticipantApple have a long history of making platform shifts relatively effortlessly. When Apple moved from PPC to Intel, they introduced Rosetta that ran PPC apps seamlessly on the Intel hardware. It was an amazing transition for me when I migrated my PPC Mac over to a new Intel MBP. Everything just worked, it was an amazing experience. So amazing that for years I used a bunch of command line tooling that were PPC compiled and didn’t notice until I upgraded to Lion. Now not everything shifted 100% but a good chunk of what I needed worked without me even noticing. Apple implemented a similar emulation system for going from the 68k to PPC as well.
What I see in Project Catalyst is the start of Apple’s ARM unification strategy, catalysed from the ARM side of the fence. Microsoft’s approach of throwing out a version of Windows that works on ARM without the apps that make it a compelling experience fell flat. Project Catalyst allows Apple to work through the compatibility layer of running iOS/iPadOS apps on the Mac to give themselves a head start. I suspect once they’re happy with it is when we might see ARM powered MacOS laptop devices. The WWDC reveal from there is simple:
Here at Apple we believe in pushing the limits. That’s why in 2007 we introduced the iPhone which revolutionised the phone market by providing a touch native device that worked with your fingers and redefined what it meant for mobile web browsing. In 2010 we brought to the world the iPad, our take on human first tablet computing. We leveraged the power of the existing iOS ecosystem to kickstart the iPad and it’s only grown from there. In 2019, we released iPadOS to leverage the powerful computers that exist in our iPad line. We also released Project Catalyst to give our iOS and iPadOS developers the ability to bring their applications back to the Mac. Now in 2021, we’re proud to introduce our first MacBook Air laptop powered by an ARM chip with all of your favourite iOS apps accessible on the Mac directly via Project Catalyst. If you’re a developer in the room here today who hasn’t looked into leveraging Project Catalyst then I’d encourage you to get started today and we’ve got a wide range of sessions here at WWDC to get you up to speed on the latest features and capabilities of Project Catalyst.
An alternative world is they ship both one of their ARM chips and an Intel chip together with the lower powered ARM chips running on the ARM side and the Intel native running on their side but with the “this app is consuming more power” notification. They’ve got enough space to put in one of their
For an application like Tap Forms I could see leveraging Project Catalyst to bring it back to the Mac, I could almost see a Tap Forms via Project Catalyst and a Tap Forms Pro on the desktop. As someone today using an iPad Pro with a Logitech keyboard, I’d love more keyboard shortcut support in Tap Forms on iPadOS (ability to run scripts with the same keyboard shortcut as on the desktop would be great!).
Of course all of this doesn’t solve having to rewrite a lot of code and implement form layouts on iOS/iPadOS. That’s still a mountain to climb.
-
AuthorSearch Results