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,891 through 1,905 (of 2,989 total)
  • Author
    Search Results
  • #40684
    Victor Warner
    Participant

    Sam,

    Thank for the further reply,

    I eventually worked out how to use

    search.getREcords()

    , by replacing:

    for (let rec of form.getRecords()){

    with

    for (let rec of search.getRecords()){

    Just one follow-up question: Does the it only work with an advanced search and not an ordinary search (Command + F)? I have tried with an ordinary search but the script does not operate.

    #40682
    Marc Reichert
    Participant

    Hello everyone,
    Tap Forms seems like the perfect solution to what I have to do and I think I will buy the Mac version regardless of the outcome of this question.
    I am not sure if I can create a fully automated solution to the following problem as I have read about the problem of local file access restrictions in this forum. Nevertheless, I did not find an entry in the forum or in the support area that was specific enough to give me a final answer and I could imagine that this could also help others.

    The task is to catalog a really large amount of artwork, including photographing and collecting all of the metadata like size and type with a small preview image in a database (which appears to be Tap Forms).
    To achive maximum throughput, I want to print labels with barcodes in advance (they have to be durable and good thermal transfer label printers are prohibitively expensive, so printing the labels afterwards is not an option). Then I would place a barcode on the back of the artwork and scan the code in the photo software to generate coherent file names for the images. These images are saved, for example, in a shared folder.
    The perfect solution from there on would be to use Automator to create a “folder action” that runs a script to generate a new database record with the image and ID based on the file name each time an image is added to the folder.

    Am I right that this is not possible due to the limitations of sandboxing? Or can I bypass those by sending those files to the Mac via the FTP-Connection or by directly writing them into the Tap Forms Documents area?
    Are there other ways to automate something in this process?

    Thanks in advance
    Marc

    #40672
    Brendan
    Keymaster

    Layouts in menu done. And working on allowing you to switch layouts from a Script.

    #40670
    Victor Warner
    Participant

    Thank you for both comments.

    Ideally, it would be very helpful to layouts also available from a menu, in the same that forms (and in a similar to FileMaker).

    Without either JavaScript support or menu support it is not possible to ‘reach’ layouts other than manually (unless I am missing something) – particularly if you have a lot of layouts which run off the right of a page.

    I do hope that Brendan can improve this area of Tap Forms in the next major update.

    #40666

    In reply to: Missing SOME Images

    Sam Moffatt
    Participant

    I use sync with attachment heavy databases via CouchDB without significant issues. I can’t comment on the Nearby sync but it’s the same technology. iCloud has a long history of issues and I’m not surprised at the posts about TF having sync issues with iCloud. I also find iCloud brutally slow due to their rate limiting which is ameliorated with running ones own CouchDB server.

    The one challenge with a distributed peer to peer replication topology is that when there are conflicts due to changes on multiple devices that sooner or later conflict resolution generally involves discarding a change. Nearby sync is also unidirectional so you need to make sure both sides are pulling changes otherwise you can introduce conflicts quickly (when you add a remote device to Nearby sync, you pull it’s changes but you don’t push your changes; you need to add your local device to the remote device for bidirectional sync). iCloud sync will also have this problem which I feel can be exacerbated due to the throttling it puts in place. I’ve also seen this with CouchDB as well where I need to make sure I wait for sync to finish otherwise my edit of the older version of the record can wipe out other changes.

    Many moons ago there was an issue with the sync system around attachments where it would have a mismatched internal revision identifier but that has been fixed for what feels like years now and myself I’ve not seen any issues. I did run into a recent change that CouchDB 3.x set the document size limit to 8MB which broke a few records of mine that had high resolution images embedded in a notes field. That was fixed by removing said high resolution images from those fields.

    I will say one thing I’ve noticed is sometimes if I pick up a device that hasn’t been sync’d for a while it can introduce some weirdness with stuff being picked up. I haven’t seen this behaviour for a while but there were some times it felt like conflict resolution got it wrong. Again with a stable CouchDB server this seems less problematic.

    The other advantage of setting up a CouchDB server is you can also set up backups and versioning. You can checkout my GitHub repo for how to get it setup and running which will give you an extra safety net for both the documents and any attachments. I run this backup script on a 2011 iMac I have to keep track of my documents. I also use a backup of my documents via Time Machine as well but that’s more for ensuring I can rewind a document if something gets corrupted.

    #40665
    Sam Moffatt
    Participant

    I was running into an issue where the record state for a Link field wasn’t updated properly within a script context. I ended up solving it by adding an explicit form.saveAllChanges() after I did a addRecordToField(). If I didn’t do that, I ended up in these weird situations where the inverse relationship metadata wasn’t setup properly which caused weirdness with script fields that were triggered. Might I suggest adding it not just at the return but each time you manipulate a link field.

    #40660
    Victor Warner
    Participant

    I suspect that the answer to this question is ‘no’: is it possible to use a Form script to select a particular layout in a particular form of a document?

    #40659
    Victor Warner
    Participant

    Looking through the forums there are not really proper descriptions for the use of AppleScript. Several of the returns from a search are linked to threads which are blocked to non-beta participants too.

    I have worked out how to open a Document with AppleScript, but would like to know the correct syntax:

    1. For selecting a particular form in a document
    2. Selecting a particular advanced search in a form; and
    3. Running a form script in a particular form of a document

    #40653
    Brendan
    Keymaster

    Hi Larry,

    Are you remembering to call form.saveAllChanges(); after you return from your script? I’m sure you are. That should generate an update notification to update the record display.

    Maybe if you email me an archive of your parent form then I could take a look at it and run it through the debugger to find out why it’s not updating the child record.

    Thanks,

    Brendan

    #40646
    Larry Zappaterrini
    Participant

    Hello!

    I’m working on a script to maintain a linked field via the value of another field both on the same form. The field that will be getting modified is a simple text field that will contain ; delimited string tags. The linked field that is based on those tags references a separate form with entries that are keywords. My goals is to parse the tags and have the linked field’s values set based on those tag values.

    I have the script to do this pretty much working with a couple of caveats. The script removes all of the entries in the linked field via removeRecordFromField(), parses the tags, looks them up in the linked table, and adds them to the linked field using addRecordToField(). The script executes as expected but the linked field doesn’t seem to be updated. If I open the keyword form and go back to the main form the linked field the shows the updates. Also, if I add a new keyword into the tag field along with an existing one, the new keyword is created in the linked form, but the new one is the only value in the linked field.

    Has anyone seen similar behavior in this type of scenario that might have some advice?

    Thanks!

    #40640
    Brendan
    Keymaster

    Hi Mike,

    You could do this all in one script.

    function hasAttachments() {
       var attachments_field_id = 'fld-......';
       var attachments = record.getFieldValue(attachments_field_id);
       if (attachments.length > 0) {
          return "YES";
       } else {
          return "NO";
       }
    }
    
    hasAttachments();

    When you call record.getFieldValue(attachments_field_id); Tap Forms will return an array of items. Then you just check to see if the length of that array is greater than 0 then you do have attachments.

    Hope that makes sense.

    Thanks,

    Brendan

    #40635
    Michael Tucker
    Participant

    I have a form for keeping track of purchases that have warranties so when something breaks I can go look in one place instead of needing to go round up old receipts.

    I do most work on iPad. There is a second form for log entries, and the log can include attachments.

    When using the primary form, and then accessing the secondary form — it is useful to know if there are attachments in the log. You can see on mac but not on iPad.

    Usually the brief info in log is enough but if there were an attachment, it might bear opening the log to see and a flag there is an attachment to know to open the log becomes useful.

    If there is a way to make a script to notice an attachment exists and then yield “Yes” that would be a one step process. But not sure how.

    Currently I use a script that yields a number 1 if an attachment exists in field it looks at. Then a second calculation field looks at the script field and if the script field is 1, it gives a textual “Yes”.

    The script shows errors but does not seem to impede the function.

    Maybe someone knows how to improve?

    Eliminate errors in script; perhaps consolidate all functions in the script to get “Yes” instead of running two fields to get the “Yes”.

    Thanks, Mike

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

    To get the sort of autonumber feature you mention you need to have a shared generator to issue the numbers. How does the first device “know” how many records have been created on any other device?

    You could set up a web service somewhere that all of your devices can refer to that sets the number. You’d need to create a web service somewhere that all of your devices can access and then a script field to retrieve the number from the service to save in your document. I’d make the script and it’s target field two so that you can handle if the number service is unavailable to give you a number.

    This would give you a monotonically incrementing source of numbers though there is the risk that you will still have holes from time to time (numbers that are allocated but not used or used in deleted docs) however completely avoiding that in a fully distributed system like Tap Forms is impossible.

    #40617

    In reply to: Display linked content

    Brendan
    Keymaster

    Hi Vera,

    Ok, so your script is good, except the only thing you’re not doing is returning your invoice number value.

    Where you’ve said record.getFieldValue(invoice_number_id), you could just prefix that with return. As in return record.getFieldValue(invoice_number_id);.

    But better would be to just return the first invoice number from the first record in the array.

    To do that, use this code after the var link_invoice line (line 5).

    if (link_invoice.length > 0) {
        var first_invoice_record = link_invoice[0];
        return first_invoice_record = first_invoice_record.getFieldValue(invoice_number_id);
    }

    The above code just checks to see if there is at least one link_invoice record. If so, it then gets the first link_invoice record from the list of linked records. Then it gets the value from the invoice_number field.

    And that’s it!

    Hope that works for you.

    Thanks!

    Brendan

    #40610

    In reply to: Display linked content

    Vera Milosavich
    Participant

    I’m sorry for being so dense, but I’m afraid I don’t completely follow. And I also think I neglected to specify something…

    When you say I haven’t defined link_invoice, that’s the name of the link-field I had set up to link the two forms, but it wasn’t in my screen shot. I assumed a link field is more like a reference field (like hidden instructions) and wouldn’t display any content on my forms. If it should display content, can you tell me what and how? Or do you mean it needs to be defined as a variable at the top? But I’m still at a loss for what to define.

    I followed your instructions for the Child Records Loop script and got my hopes up when it didn’t return an error in the script editor, but I still did something wrong. It puts “Hello World” in all the invoice_number fields when that should either be one of two different invoice numbers or blank — to coincide with the month-year field contents. Where the “do something” placeholder comment appears, I tried doing what made sense to me. The result is the same with or without that. And I don’t know where it got “Hello World” from. It doesn’t appear in any record of either file — except where it put it.

    My new attached image shows all this.

    Attachments:
    You must be logged in to view attached files.
Viewing 15 results - 1,891 through 1,905 (of 2,989 total)