Tap Forms app icon half
Tap Forms Forum text image
Blue gradient background

Exchange tips and ideas with the Tap Forms community

Search Results for 'script'

Viewing 15 results - 1,321 through 1,335 (of 3,052 total)
  • Author
    Search Results
  • Brendan
    Keymaster

    Yup. That’s the solution to your export issue. I’m glad you found the script works for you. Because each form has a different set of fields and there needs to be the header row and there could also be a number of related records, it’s impossible to include the related records in the parent form. That’s why Tap Forms creates separate CSV files for each.

    But that’s also why I built the scripting engine to help with unique cases like this.

    Thanks!

    Brendan

    #44821

    In reply to: Gear check list

    Juha Ranta
    Participant

    Hi,

    I didn’t get to figuring out how to create the actual gear list from Tap Forms. But if anyone is interested in how I did export from that Skurka’s gear list to TaskPaper/OmniFocus, here’s what I did. I’m thinking of doing something similar if I get the TaskPaper gear list working.

    – I added my gear to the Google Sheets document, with some modifications.
    – Exported to a csv file.
    – Converted the list to a Taskpaper format with this quick Ruby script. It’s specific to the format that was in that Skurka page, but you get the idea.


    require "byebug"
    require "CSV"

    csv_file = ARGV[0]
    csv = CSV.new(File.new(csv_file)).read

    # Skip the header row.
    csv[1...].each do N|row|N
    # Skip the empty rows.
    next if row[0].nil?

    my_requirement = row[5]
    my_item = row[6]

    if row[1].nil? && row[2].nil? && row[3].nil?
    puts "\n#{row[0]}:"
    elsif !my_item.nil? || my_requirement == "Required"
    taskpaper_item = "\t- #{row[0]} - #{row[6]}"
    puts taskpaper_item
    end

    end

    Then I’m able to open the checklist while packing with MacOS TaskPaper. Or, since OmniFocus supports importing TaskPaper files, I can add it there as well. See the attachment.

    Attachments:
    You must be logged in to view attached files.
    #44814

    In reply to: Split note field?

    Sam Moffatt
    Participant

    Also uploading the archives. I need to get better at doing this as well.

    The TFF is a Tap Form Form Template, import it via File -> Import -> Form Template in a document. Form Templates are just the form definition, fields and form scripts without the data.

    The TFARC is a Tap Forms Archive, import it via File -> Import -> Tap Forms Archive in a document. A TFARC has all of the same data as the form template but also includes the records, in this case the sample data used in the example here.

    Attachments:
    You must be logged in to view attached files.
    #44812

    In reply to: Gear check list

    Sam Moffatt
    Participant

    Looking at the sample checklist I’d probably structure four forms:

    – Template: blue columns; the category heading (e.g. “footwear”) is another field. Add a checklist for “active”.
    – Hikes: hike metadata of when, where, etc that isn’t checklist related.
    – Checklist: green columns; the category heading (e.g. “footwear”) is another field.
    – Gear: simple form with your gear information normalised.

    Category heading is another field because it’s really a property of each row in that spreadsheet but we need to tell the computer that. Tap Forms has a spreadsheet like view, the multicolumn list view (MCLV), and you can use the grouping feature to recreate the column heading.

    I’d model Hikes as being linked to Checklist and Checklist having a link to Gear. You might want to add a “default gear” field to the template that can be used as well for stuff you almost always use (same sun glasses). From there I’d likely look at scripting to create a “hike” and then create new checklist records, linked to the hike, from the template records. I added the “active” field to the template so that you can use a saved search on active records when creating the checklist items. It allows you to have a template item that isn’t copied easily.

    On my YouTube channel, I have a <a href=
    https://www.youtube.com/watch?v=TB4EavvTihQ&list=PLyMabv86X9YFlGFdj5BWszcgYd9cSc-Jw”>playlist on building a meal planner which includes a shopping list that is built on the fly. Episode 3 introduces the shopping list and covers how to create “trips” with items from the list that haven’t been bought yet. A similar approach could be used where instead of a shopping list, it’s your template form and you create a hike from it and copy the entries over to the checklist. I made some tweaks in later episodes to the scripts for QOL but episode three demonstrates finding records, creating a new one and linking them together. The video on processing semistructured data into records also covers a use case where I’m copying data to create a new record though the focus parsing there.

    On the value replication for stuff like weight, you can use a calculation field to copy field values from parent of link to form 1:M though going the other way requires scripting to handle multiple values.

    Bit of a mind dump, hope this helps!

    #44810
    Juha Ranta
    Participant

    Hi,

    I’ve already made an inventory of my hiking, travel, trail running etc gear in Tap Forms. I like having the gear information, personal notes, weight, etc with me.

    Now, I’m trying to create something like this Andrew Skurka gear list for travel/hiking list. https://andrewskurka.com/backpacking-gear-list-template-checklist-3-season/

    I have the gear in Tap Forms already. I’ve been thinking of different options to create this kind of a gear list. In the end I’d like to export is as a Taskpaper/OmniFocus list.

    I did it this it this time by exporting from Tap Forms as CSV, then importing the items with their weight in Google Sheets. It was plenty of manual work.

    I wonder if there’s a good way to implement this kind of a system in Tap Forms. It would need:

    – Topics for things like
    – Utilities
    – Clothing
    – Food
    – Reference to select a tool from the gear list in Tap Forms
    – Way to calculate total count, maybe some more complicated calculations, such as in back / clothed on me
    – A default template that has the typical gear that’s with me for a backpacking hike for instance

    So I was thinking if this kind of a gear list system is easy to do with Tap Forms, or maybe I should export to csv, import to some spreadsheet software, etc. I work as a software engineer and can do scripting too with Ruby, Python, etc. I’m not just sure about what’s the best way to implement this kind of a thing at the moment, so I’d appreciate feedback. Thanks!

    Konrad Schoettl
    Participant

    No, there isn’t a circular reference as you described. I think I have found the reason for the crash. This occurs only with more than one ‘Link to Form’ field defined (in my case, there were two fields, each ‘many to many’). With only one such field, the export including the linked records works fine. But anyway, the export doesn’t work as I expected. I get several separated CSV files. But I wanted to get one file, containing also the linked records. For my book example, I wanted to export all books from the book form, including the author’s names from the author form. But the column for the author’s names (Link to Form) is empty.

    I found another solution for this purpose. I defined a script field in the book form that copies the author’s names into the book form. Now I can export the books with all author’s names into one file, what is what I wanted ?.

    Thanks
    Konrad

    #44803
    Daniel Leu
    Participant

    2 – If it isn’t in fact possible to search attachment fields, is there another way to do this?

    You can use a field script and use following code. This will return 0 if there are no photos and 1 if there is at least one photo. You just need to add the ID of your Picture field.

    function Has_Photo() {
    	let photo_id = 'fld-xxx';
    	let photo = record.getFieldValue(photo_id);
    	
    	if (photo.length > 0){
    		return 1;
    	} else {
    		return 0;
    	}
    }
    
    Has_Photo();

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #44801
    Sam Moffatt
    Participant

    Maybe you could maker a timer/countdown app that supported x-callback-url and could be used in combination with scripting or URL fields in TF.

    #44775
    Kenneth James
    Participant

    Thank you. I knew of the distinction, and I even found my Java Script book to verify and all I was seeing were examples for the assignment designation – the single “=”. It just didn’t occur to me that that was the problem.

    Problem solved!

    Thank you
    KDJ

    #44770
    Kenneth James
    Participant

    I am misunderstanding something about how and when scripts are triggered and when they fire. My use case: Trying to set a toggle switch (CheckMark field) in a record that will populate a default value in the Location field, otherwise, just leave the Location field alone.

    The script in the Script Field.

    function Default_Location() {
    var useDefault = record.getFieldValue('fld-332bc0f45e1d4a9bbcf6b90d0087234e');
    
    console.log(useDefault) 
    	
    	if (useDefault = false) {
    		// the check mark is NOT checked meaning add the default location
    		record.setFieldValue('fld-e83fedb15a0d4a09be818513c2a0f4e5',
    			JSON.parse(

    {
    “altitude”: “849.74”,
    “heading”: “-0”,
    “lat”: “46.9999999”,
    “lon”: “-118.99999999”,
    “pitch”: 0,
    “title”: “123 Main Street, Anywhere, United States”}`))
    // my actual home address goes here!
    }
    }
    Default_Location();`

    What happens:

    Add a new record:
    CheckMark field = unchecked (i.e. false)
    Location field = blank (what it should be)

    While in the record, I check the CheckMark field indicating that the Location field should be auto-populated with the default value.
    CheckMark field = checked (i.e. true)
    Location field = still blank, nothing happens.

    Close the record and move to another record

    Go back to the previous record and re-open it.
    CheckMark field = checked (i.e. true)
    Location field = still blank, nothing happened.

    IF I REVERSE THE LOGIC IN THE SCRIPT, change the if (useDefault = true), THEN a new record is populated automatically with the default location while the CheckMark field is unchecked.

    Something is not behaving like I anticipate that it should be behaving.

    Obviously, I am missing something.

    Thanks for any advice.

    Kenneth James

    #44757
    Sam Moffatt
    Participant

    You can bulk import to the pick list or if you already have much of the structure defined you could use a form field as a source and import data into the form with a field per layer of your tree.

    Attaching a form template with up to 9 layers to show how scripting can be used to build it. Import the template, fill in some values and then in the pick list setting set it up with the use values from field option (see screenshot). As you do each layer, you can duplicate the record and update the value you need to change. Should make data entry a little less error prone. Trees are rather unwieldily to deal with unfortunately.

    Attachments:
    You must be logged in to view attached files.
    #44738
    Sam Moffatt
    Participant

    Since this was posted in 2014, that’s still TF3 (desktop)/TF4 (iOS) so since then TF5 came out with support for multiple documents, leveraged a new data backend, nearby sync and CouchDB/Cloudant Sync options, image fields supporting multiple images and a pop out gallery view, the scripting engine, the charting system, access controls on the Mac, the markdown field type as well as improvements to various smaller features (e.g. extra functions for the calc system). Almost all features are parity between iOS and Mac as well (layouts I think is the biggest one missing from iOS). You can check out the 5.3.19 changelog for all of the changes in the TF5 series up to the current version.

    I believe the current focus is to move to a newer data backend due to it not being supported any more and not being able to build against newer targets.

    #44718

    In reply to: Split note field?

    Sam Moffatt
    Participant

    I turned this into a video using the above sample data and script as a basis including building out two forms to track the data. I’m going to do a follow up video on how to handle the multiline fields which isn’t currently handled for next week.

    #44687
    Sam Moffatt
    Participant

    If you’ve on the child side of a 1:M relationship then you can use a calculation field or script field to copy the value of any field from the parent record.

    If you’re using M:M relationships, you’ll need a script field to merge the data together.

    I have a video covering some of this on YouTube with a library linking example and another one on using link to form fields and duplicating field values.

    DrJJWMac
    Participant

    By default, Databases for Tap Forms are stored (deeply nested) in a folder in the user’s library folder. I prefer to store my databases on a separate volume / drive. I tried to put a symlink in the default sub-folder to point to my storage folder with the hope that I could see into the volume at the splash-screen dialog box. This did not work.

    I can see preferences to change the default locations for backups and scripts. But nothing can be done to set the default for databases, and the splash-screen does not allow easy access to a different location (outside the user’s library).

    I’d hope perhaps the limitations can be lifted for a future version.

Viewing 15 results - 1,321 through 1,335 (of 3,052 total)