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 - 2,236 through 2,250 (of 2,950 total)
  • Author
    Search Results
  • #37768
    Sam Moffatt
    Participant

    I’m a little confused because if you have two forms, one for wines and one for stores, which have a many to many link between the two and you’ve ticked the “show inverse relationship” on both sides (make sure to toggle it if you changed the type to delete and recreate the field), then on both sides you should have a multicolumn list view embedded in your record that gives you what I suspect you’re after (e.g. when looking at a wine, you can see which stores you linked). Try setting Many to Many and then toggling the “show inverse relationship” option on the “Link to Form” side of the relationship. This should be ok on either a Mac or iOS though I always go and double check it removed the field after toggling it off and then going all the way back to toggle it back on (that’s much easier on the Mac).

    On another tangent, I think this might be similar to an earlier thread on how to filter using fields in two linked forms. The suggestion I made there is that it might help to have a third form, in this case I’d probably call it “purchase”. The “purchase” form has a 1:M link from wine to purchase and 1:M link from store to purchase, maybe put a date in as well. Then you can use that inner form to track which store your wines came from and when.

    It could also be that the indexing in general is problematic and you need to copy the values from the linked forms into the parent. I wrote an example of how you can use a script field to copy values from linked records to help them show up in indexing.

    I think maybe the Link from Form field might have gotten fried so give that a spin first because this should be working. Otherwise the other ideas might help you out. I’d suggest the middle one is useful to do because it let’s you track individual purchases but maybe you’re less OCD than me :D Good luck!

    #37765
    Brendan
    Keymaster

    Well in the next update of Tap Forms I’ve added the ability for you to get access to the Pick Lists, so you could use them that way if you like from a script.

    #37755
    Martin Inchley
    Participant

    I appreciate the help, but this is proving really problematic. If the record that I want to work with is the active record in the form, why does TapForms think the record is “undefined”, just because I’ve called the script from an AppleScript? The script works when I just run it from within TapForms, but I want a simple way to successfully call from AppleScript a script that will act with the current record.

    In addition – testing out functions from the TapForms JavaScript API web page, I edited my script to read simply:

    function New_Script() {
    	form.selectRecord()
    }
    
    New_Script();

    Every time I run this script by clicking the “Run” arrow, TapForms crashes.

    #37743
    Eddy
    Participant

    Thanks for your idea, Brendan!

    But what we need is a phrase, that we can use in scripts and fields.

    Did you thought about equipping tapforms with the ability to have constants? – Somehow, we already have something like that. The picklists. So, that preferences window would be the perfect place, to store phrases to be used tapforms wide.

    Regards, Eddy

    #37741
    Brendan
    Keymaster

    Well, if you are creating a custom layout for your emails, you can add a static Text object to your layout and then type in whatever text you want to appear there. Such as your company address, email, phone number, etc. That text will appear on your custom layout for every record when you print/email your records.

    That’s another idea.

    But also Sam’s idea of having a single Form script to store a bunch of information like that which you can pull up from field scripts is a great idea too.

    #37735
    Sam Moffatt
    Participant

    I’d probably use the runScriptNamed functionality and then define the common values in a form script. You then load the form script anywhere you need to use them and it’s a single place to change. That could be populated into a field that you can refer to from a calculation field or obviously it’d work natively in a script field.

    #37728
    Eddy
    Participant

    Hi Folks!

    Actually I am falling in love with this app… In the meantime, we are starting to create even our CRM with it.

    Doing this, I have a task/problem:

    Some text phrases and numbers of us will I have to change time by time. For example the footer of our emails. Of course, I do not want to rewrite all the scipt and calculation fields than. Therefore, I do not want to write our footer (signatures) text in the script and calculation fields directly…

    But how (where) can I store text phrases, so that they will be replaced everywhere I used them in scipt and calculation field, if I change them?

    Sorry for my poor English and thanks in advance.

    Eddy

    #37692
    Kimberley Hoffman
    Participant

    I’ve made this form to plan my blog and social media posts. The original is in my bilingual English/German = Denglish, but I have copied it and put the headings into English. You might have to adjust the lists, though. I’ve noted in those areas that you will need to work on to make it your own.

    Also you might want to adjust any bilingual entries. They usually are self explanatory; but, as I am an illustrator, some of the theme topics that are relevant to me won’t be of interest to you. And in the keywords section, you might want to change the last list entry of “language” to whatever language(s) you are targeting.

    I think the really nice part of this form is the part for the keywords search. Brendan had written a little script to change your keywords into hashtags. That makes it really convenient to copy and paste them into where ever your posting to. You can use the filter to search out the top 25 hashtags for yourself and your business.

    The forms aren’t styled any particular way, I found that these work best in their straightforward manner, but you can design them as you wish.

    Good luck and happy planning. If you like it, let me know. I would love the feedback.
    (You know, we could share styled forms on Twitter ( you can tag me @)visualitysenses and Instagram (@hoffmanillustrates).
    Regards,
    Kimberley

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

    I’d expand a little on Daniel’s approach and actually suggest two forms: one for your products and then a linked form would be the individual batches. The reason for that is that you can look up your products as top tier entries and then see all of the linked batches. I’d put the form script then in that product form and create a new linked record batch records that are linked. This will save you some database traversal where you’re only looking at linked records for the individual product. You could also do some more optimisation with extra lookup fields to speed up creating new records though you can iterate through record lists in Tap Forms pretty quickly.

    #37663
    Daniel Leu
    Participant

    Interesting question…. I would create a separate form that has fields for ProductID, Batch# and BatchUpdated (date). This is used to track the current batch number and when this batch number was last updated.

    In a form script that updates the batch number, I would check if the batch number was already been updated this month. If this is the case, then it is just a matter of incrementing the batch number. Otherwise, reset it to 1. At the end of the script, update the BatchUpdated field with the current date.

    When creating a new record for your production run, you can fetch the current batch number from the batch number form.

    Hope this helps!

    Cheers, Daniel

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

    #37661
    Daniel Leu
    Participant

    I’m wondering if you have to select a form from AppleScript first? But I don’t know how the syntax would look like.

    To get a valid record, the question is, which record are you looking for? The first one, a matching one, a new one?

    Here is the concept to get to the records without having a valid form. I assume that this is the case for your since you only open a document with AppleScript.

    var records = document.getFormNamed('form name').getRecords(); // get all records of given form.
    
    // loop over all records
    for (record of records){
       console.log(record.getFieldValue(time_id));
    }

    Cheers, Daniel

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

    #37659
    Martin Inchley
    Participant

    Thanks, Sam.

    Can you give me a syntax in AppleScript or JavaScript for selecting a record?

    #37656
    Ron Kline
    Participant

    Hello All!

    I’m trying to write script for a field that will auto populate a batch # for products being made. The format for the batch # will be Product ID #-MMYYYY-Batch #.

    Product ID # – this is a number I have already assigned to every unique product that can be made
    MMYYYY – this will be the month & year for when the product is made
    Batch # – I want this to be an auto-incrementing # that starts at 1 (or 01 or 001) for each unique Product ID # a record is created for.

    So, for example, the first batch of a product (lets say product 12) made in a month would have an overall batch # of 12-112019-1 (or 01 or 001). The first batch made for a different product (lets say product 25) would have an overall batch # of 25-112019-1 (or 01 or 001). The 2nd batch made for any given product would have the same beginning numbers as the 1st batch of that product but that last batch # component would increment to 2 (or 02 or 002) and so on. When a new month comes around that batch # component would reset back to 1 (01 or 001) for products made in the new month. So for the first batch of product 12 in the new month the overall number would be 12-122019-1 (or 01 or 001).

    I have been thinking about this for the past few days but have not come up with any ideas on how to accomplish it.

    If anyone has any advice or ideas I would appreciate it

    Thanks!

    #37652
    Sam Moffatt
    Participant

    Form scripts can be executed without a record being selected. What you’re running into is that there is no record selected and as such record is undefined.

    It’s more likely to be seen on iOS where you can run form scripts from the list view without anything selected but as you’ve found out it is also achievable on the desktop as well, just less likely.

    #37650
    Martin Inchley
    Participant

    Following an email exchange with Brendan, and some further unsuccessful experimenting, I tried to use AppleScript to open a script in a new, absolutely minimal database created for my other current query in this forum about scripting time data:

    Form Script “New Script” is:

    function New_Script() {
    
    	var time_id = 'fld-33fcface42864bf3801d7bf521c14e7f';
    	var thisTime = record.getFieldValue('fld-33fcface42864bf3801d7bf521c14e7f');
    	console.log(thisTime)
    
    }
    
    New_Script();

    When run, it puts a time value into the console (albeit, as discussed in the other thread, an hour earlier than the value in the originating field).

    However, when I use this AppleScript to call it:

    tell application "Tap Forms Mac 5"
    	
    	open "/Users/martin/Library/Containers/com.tapzapp.tapforms-mac/Data/Documents/Time testing.tapforms"
    	set doc to document "Time testing.tapforms"
    	run doc script named "New Script" in form "New Form"
    	
    end tell

    I get the following console message: “New Script: TypeError: undefined is not an object (evaluating ‘record.getFieldValue’), column:23, line:4”. Column 23 of line 4 is the dot in record.getFieldValue.

    I suppose this is an improvement on nothing happening (!), but I don’t understand why this should happen.

Viewing 15 results - 2,236 through 2,250 (of 2,950 total)