Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Script Talk › Help with Scripts.
- This topic has 7 replies, 5 voices, and was last updated 4 years, 1 month ago by Sam Moffatt.
-
AuthorPosts
-
September 21, 2020 at 8:24 PM #42010
Michael MckennaParticipantNot sure if this has already been posted or seen , but it’s not showing in my list of posts so I will re post my questions.
I am interested in understanding how scripts work and I read the dummies script lesson and still have no idea how it works. I have looked for videos on Youtube and found one that was still a bit complicated for me. I have read the definition sheets , JavaScript API sheet, that gives a brief explanation, however I am still scratching my head…. yes a really dummy.
I have been through the script forum and I was wondering if someone could write me a simple script so I can copy and learn from there.
Maybe theres a simple script video available… I am very much a monkey see monkey do kinda guy.
I would like to populate a field entered on a form ,not linked, and have that field auto populate another on same form.
Thank you for your time.
Kind regards
MichaelSeptember 21, 2020 at 9:56 PM #42011
BrendanKeymasterHi Michael,
If both your fields are in the same form, then all you need to do is, in the Script Editor, double-click on the field you want to copy from. Tap Forms will write the code for you to retrieve the current value of that field.
Then, look at the Snippets and double-click on the Set Field Value snippet. That’ll insert the command into your code at the cursor position that will set a value for a field.
Here’s an example of copying a value from one field to another:
function CopyScript() { var from_field_id = 'fld-.....'; var from_field_value = record.getFieldValue(from_field_id); var to_field_id = 'fld-.....'; record.setFieldValue(to_field_id, from_field_value); } CopyScript();
So when the from_field is changed, whatever value was in it will be copied to the to_field.
What you want to do with the from field value however is up to you. This is just a straight copy. But you may want to check the value, compare it with something, then set a different value into the to_field.
September 23, 2020 at 5:12 AM #42020
T.L. FordParticipantYou went through the 101 tutorial?
http://www.cattail.nu/tap_forms/tap_forms_scripting_101/index.htmlSeptember 23, 2020 at 4:38 PM #42022
Michael MckennaParticipantYes, l did read through all the examples given in the tutorials 101, however it still makes absolutely no sense to me at all. My comprehension ability is very poor and l am much better watching a video with examples showing a basic real example. If l have something visual to follow along with it makes it easier for me then to experiment, as l mentioned above, l am definitely a monkey see monkey do learner.
Is their a video that might help on YouTube, l can’t be the only moron who is struggles with this. ?
On a different note, I was wondering can you place pick lists into folders in the preferences section. My lists are going to get very long or is there another way of organising through a different area.September 23, 2020 at 6:30 PM #42023
Sam MoffattParticipantI did some videos a while back on TF but they’re not intro guides: https://www.youtube.com/user/pasamio. I’ve always meant to go through and do a bunch of basic tasks because I agree, having video helps. So many things to do, so little time.
September 27, 2020 at 7:58 PM #42052
Sam MoffattParticipantI did a video on building a script that joins a couple of values together and also shows an example of using the child records loop. Shows how to use the editor to put stuff together and also how to use extra values with the child records loop. Hopefully it’s helpful or useful.
October 14, 2020 at 3:55 PM #42275
Christopher ClarkParticipantThese videos are awesome Sam! Thank you!
October 14, 2020 at 7:08 PM #42278
Sam MoffattParticipantHappy to hear it’s helpful for you!
-
AuthorPosts
You must be logged in to reply to this topic.