Search Results for 'script'
Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Search › Search Results for 'script'
-
AuthorSearch Results
-
December 2, 2022 at 6:53 PM #48407
In reply to: What causes a script in a form field to execute?
Brendan
KeymasterHi Lane,
I’m glad you’re managing to work through these issues. Welcome to the world of programming! Things don’t always go the way you hope or expect. That’s my life programming Tap Forms! :)
A script is triggered, as you’ve found out, when the value in whatever field is reference by
var some_value = record.getFieldValue('fld-.....');changes.Thanks!
Brendan
-
This reply was modified 2 years, 11 months ago by
Brendan.
December 2, 2022 at 4:45 PM #48405In reply to: What causes a script in a form field to execute?
Lane Robinson
ParticipantI’ll further add something that happened to me. This may or may not be something you are facing. I thought a script wasn’t executing properly. I eventually realized that it was getting data from another field that wasn’t updated yet. It was a calculation field that also references another field, and it’s turtles, always the way down. I’m rewriting my script to avoid this.
December 2, 2022 at 4:37 PM #48403In reply to: What causes a script in a form field to execute?
Lane Robinson
ParticipantI recently learned that for Field Scripts, any time a field changes that is referenced in your script, the script will execute.
With Form scripts that doesn’t happen. You manually run those.
Here is where it states that in the documentation. https://www.tapforms.com/help-mac/5.3/en/topic/scripts
-
This reply was modified 2 years, 11 months ago by
Lane Robinson.
December 2, 2022 at 2:52 PM #48402Topic: What causes a script in a form field to execute?
in forum Using Tap Forms 5richard maliszewski
ParticipantI am battling onward with my envelope-system. Have prototyped a “transfer” form…entries in a record therein, when my field script runs, create correct entries in both the “to” and “from” envelopes. But thus far, I’ve only been able to run the script from the script editor. It’s my intent to create a layout for this form with a commit button that runs this script. This has to be simple/obvious, but several searches for relevant posts haven’t gotten me anywhere yet.
Any help for the blind here very appreciated.
–Richard
loshen tashi
ParticipantThank you Brendan!
I can see the thing with the Pick List but im not convice for my case.
Maybe i can find a script in action with a sort of Task GTD thing?December 1, 2022 at 8:08 PM #48395In reply to: Displaying Saved Search on Apple Watch
Brendan
KeymasterHey Eddy,
I moved this topic to the Using Tap Forms forum. It didn’t belong in the Script Talk forum where you posted it.
So this used to work, but I’m not sure what happened to it. You used to be able to press down on the screen on the records list view to display the search commands. There was even voice search and you could tap a button to see the list of saved searches which you could then select. I didn’t change anything or remove that function in my code. I think with the removal of the Force Touch from watchOS 7, that feature simply vanished. I was trying to find a different way of engaging Force Touch, but it seems there’s no alternative. So I’ll have to think about what alternatives there can be for displaying that menu of search options.
Thanks,
Brendan
Daniel Leu
ParticipantCertainly you can do this with a script. A while back, something along these lines was already discussed in the scripts forum.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksDecember 1, 2022 at 2:31 PM #48388In reply to: can I lookup a value from field of other form?
Daniel Leu
ParticipantOr you could use a script that copies the value from the second form only when the target field is empty. This way, initially it is set by the script but later, you can overwrite the value if needed.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksDecember 1, 2022 at 1:47 PM #48386In reply to: can I lookup a value from field of other form?
Lane Robinson
ParticipantThanks for your response. What you’re saying for new records I think would work fine. I can manually alter the table.
The tricky bit left is I don’t know how to populate the historical data from old <!– voldemort –> database into a table. I still need to use a calculation or script to get the data out of the table for sorting since I can’t sort by the table.
I’m going see what an export of records from a Form with usual fields and a Table from Tap Forms looks like. Perhaps I can manipulate the export from the old database into something I can then import.
hmm. nope. The table doesn’t export from Tap Forms. So I’m doubting I could import it.
-
This reply was modified 2 years, 11 months ago by
Lane Robinson.
loshen tashi
ParticipantHey Brendan,
Thank you :-)
Saved seearches are very powerful but it’s not what i expected.
I wonder if we can do like a GTD app, if the task is checked, there is event after (color change, archive, move,…)
Maybe it’s possible with a script!?December 1, 2022 at 12:54 PM #48383In reply to: Use total of form column as trigger?
Brendan
KeymasterThe Calculation Field and Calculation Type settings on a Form just tell Tap Forms what the default calculation value to display is on the Single Column List View. Although it does display that result if there’s no Field level summary calculations set.
There’s a popup button that will display the aggregate calculations for all of the individual Field level Summary Calculations. By selecting a different one to display, you’re changing the Form’s Calculation Field. It has no bearing on the Multi-Column List View because that view will always display all of the individual Field level calculations.
There’s no Field ID available for the Calculation Field setting explicitly because that’s just a reference to the actual field in the form, which you can get the ID for either on the Script Editor as Daniel mentioned, or at the bottom of the Fields list on the Fields tab of the Form inspector panel.
There’s no ability to watch the aggregate calculation. But the Scripting engine does have functions for getting that value if you need to.
For example, to get the total of a field in a form, use:
form.getTotalOfField(fieldID);You can of course get the form using either
formif it’s the currently selected form orlet other_form = document.getFormNamed('Other Form');December 1, 2022 at 12:45 PM #48382In reply to: can I lookup a value from field of other form?
Brendan
KeymasterThe Table field is a good use for being able to select a record from another form, and to be able to override a value (price) coming from the other form. That’s because with a Table field, the values are copied from the selected record rather than having a reference to the original record like in a Link to Form field.
Scripts execute automatically whenever a value in a field they reference are updated.
It’s triggered by the
record.getFieldValue('fld-.....');call. When you change a value in a field, Tap Forms checks to see if that field is referenced by any scripts or calculations. If so, it runs the scripts and evaluates the calculation formulas in those other fields.December 1, 2022 at 12:16 PM #48378In reply to: Pick list sort order (2nd)
Lane Robinson
ParticipantJust thought I’d provide some feedback on my finding this useful to sort records by month. A saved search shows me everything in a year. Being able to use the pick list I use to enter the month on the record is nice, and I’m sure I’ll use this other places too.
I modified the script from the Script Manager a little bit. I wrap the offset with Number() to convert it to a number. It’s text apparently. (I’ll learn this javascript yet.)
Thanks for the useful resource Sam.
(I’m not sure how to preserve the tabs in the code. I thought the code tag would do that.)
// NAME: PicklistID // VERSION: 1.0 /** * PicklistID returns the offset index of a value from a pick list. * * This is useful for creating a surrogate field for sorting a field * that uses a single value pick list by the ordering of the pick list. * * Reference: * https://www.tapforms.com/forums/topic/pick-list-sort-order-2nd/#post-46660 * * @param {string} keyfield_id - The internals Tap Forms field ID for the source field. * @param {string} picklist_name - The name of the pick list to use for ordering. * * @return {(number|null)} The offset matching the value from the field or null if not matched. */ function PicklistID(keyfield_id, picklist_name) { let key = record.getFieldValue(keyfield_id); let picklist = document.getPickListNamed(picklist_name).values; for(let offset in picklist) { if (picklist[offset].value == key) { // just because when I see it I want to see 1 for january return Number(offset) + 1; } } return null; } var month_id = 'fld-370f51968e3146dca058b82ef34b1592'; var list_from_picklists = 'Months'; PicklistID(month_id,list_from_picklists);-
This reply was modified 2 years, 11 months ago by
Lane Robinson.
-
This reply was modified 2 years, 11 months ago by
Lane Robinson.
November 30, 2022 at 3:30 PM #48373In reply to: can I lookup a value from field of other form?
Lane Robinson
ParticipantJust an update. I just realized I won’t actually be able to use the calculation at all for the price discussion earlier in this thread where I thought I had a work around. I need to be able to override the price. I’m back to needing to have it auto fill an Ad Price field based on a change from the Ad Size field. And then still be able to override the Ad Price field manually.
So I guess my question is, with javascript and the API, can I do that? Or will it run and write over when I choose recalculate formulas? I don’t understand what triggers a Script field type to run. So much to yet to learn about Tap Forms!
November 30, 2022 at 10:04 AM #48371In reply to: Use total of form column as trigger?
Daniel Leu
ParticipantThe field ID will not change. You get the code in the script editor: click on the name of the field and then on
ID. This will insert the code in the editor section.Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks -
This reply was modified 2 years, 11 months ago by
-
AuthorSearch Results