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 - 121 through 135 (of 2,990 total)
  • Author
    Search Results
  • #52582

    In reply to: Autofill advice

    Daniel Leu
    Participant

    Thank you for the coffee! I appreciate it!

    One more thing: My intention for the script was, that it’s used as a field script and not a form script. This way, whenever you set the coin type, the denomination field is automatically set.

    Cheers, Daniel

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

    #52580

    In reply to: Autofill advice

    Daniel Leu
    Participant

    My script wasn’t intended to save the value to a field, but the return value would be the denomination. To save the field value, you need to use record.saveFieldValue() as you do, but you need to add document.saveAllChanges(); as well.

    Cheers, Daniel

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

    #52574

    In reply to: Autofill advice

    Mark Moran
    Participant

    Ah, makes sense. Thanks. It works but it doesn’t update the field. I’ve tried updating a text field demonination or the script field itself but it remains blank. I added the bolded lines below and it still isn’t working:

    const coin_type_id = “fld-1231556e0f234de9b2d85f50225b8135”;
    const coin_type_demon = “fld-b7559ec0da8b4b42a9d270e1686e4746”;

    // get the denomination from the matching coin type record
    const denomination = matchingCoinType.getFieldValue(coin_types__denomination_id);

    record.setFieldValue(coin_type_demon, denomination);

    // return the denomination
    return denomination; // set return type as tex

    • This reply was modified 6 months, 3 weeks ago by Mark Moran.
    • This reply was modified 6 months, 3 weeks ago by Mark Moran.
    #52564

    In reply to: Autofill advice

    Mark Moran
    Participant

    Wondering if I can or should someone move this to the Scripting forum??

    I tried what you suggested. Both forms are in the same document and I’ve double checked the fld’s. But I get this error???

    Get Demonination: ReferenceError: Can’t find variable: getFieldValue, line:(null)

    =====

    // define fields in the main form
    const coin_type_id = “fld-1231556e0f234de9b2d85f50225b8135”;

    // define fields of coin types form
    const coin_types__type_id = “fld-415d31330587455cab106835b1d075fe”;
    const coin_types__denomination_id = “fld-528c65271e894ebda93268d20f2329ad”;

    // get the coin type from the main form
    const coinType = getFieldValue(coin_type_id);

    #52553

    In reply to: Autofill advice

    Daniel Leu
    Participant

    I would create a form for your coin types with two (or more fields), one is the type and the second one is the denomination. This way, you have an easy way to enter your data. A pick list would use that table as input which then is used for your dropdown.

    Then the denomination field can be set as the result of a field script. Following is an example. It should work but I haven’t verified it!

    You need to set the field ids and the form name according to your database.

    function getDenomination() {
        // define fields in the main form
        const coin_type_id = "fld-xxxxxx";
    
        // define fields of coin types form
        const coin_types__type_id = "fld-xxxxxx";
        const coin_types__denomination_id = "fld-xxxxxx";
    
        // get the coin type from the main form
        const coinType = getFieldValue(coin_type_id);
    
        // get the types from the coin types form
        const coinTypeForm = document.getFormNamed("Coin Types");
        const coinTypeRecs = coinTypeForm.fetchRecords();
    
        // get the matching coin type record
        const matchingCoinType = coinTypeRecs.find(coinTypeRec => coinTypeRec.getFieldValue(coin_types__type_id) === coinType);
    
        // get the denomination from the matching coin type record
        const denomination = matchingCoinType.getFieldValue(coin_types__denomination_id);
    
        // return the denomination
        return denomination; // set return type as text
    }
    
    getDenomination();
    • This reply was modified 6 months, 4 weeks ago by Daniel Leu.

    Cheers, Daniel

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

    #52550
    Mark Moran
    Participant

    Hi,

    I’m looking for some advice. I know just enough about scripting/programming to get myself in trouble.

    I’m setting up a coin database. There will be a dropdown field for coin types (e.g., Lincoln Penny, Jefferson Nickel, etc.) and a separate field for denomination (e.g., 1 cent, 5 cent, 1 dime).

    I’d like the denomination field to autofill based on the selected coin type. Some coin types will share the same denomination (e.g., both Lincoln Penny and Indian Head Penny = 1 cent).

    What’s the best way to accomplish this—using a script, a calculated field, or something else?

    Thanks!

    shire23
    Participant

    Hey Brendan,

    I’m really enjoying TF Pro. You have done an incredible job with all versions of TF. I’m proud to say I’m a long-time TF user. I guess it was probably around 2009ish I found TF on the App Store and fell in love with it. I was amazed at how I could have a fully functional and customizable database on my phone, especially right when the App Store was really just starting to get its footing. TF was way ahead of its time and still is. After a number of years I became a traitor and went to Android for a while. The whole time I was on Android I was chasing that TF experience in the Google Play store to no avail. When I came back to iPhone I snatched up TF5 and use it every day. Now I’m happy to upgrade to a Pro subscription and support an amazing app by an incredible developer.

    The new features have been great and I have only ran into one issue so far. I have a form in TF that I use to track product reviews. One of the fields in my form is a Note field titled “Review”. In TF5 I configured this field so that it has a default value of the review template I created (ss attached). I upgraded from TF5 and imported my .tfarc file into TF Pro. When I go into the field options for my Review field in TF Pro and tap into the “Default Value” option the app crashes immediately. Is this something you’ve heard of happening before? Thanks a ton!

    -Josh

    Attachments:
    You must be logged in to view attached files.
    #52492
    Tap forms Forum
    Participant

    Is there a way to read/write to sub-levels in Cascading Pick Lists in scripts?

    karen james
    Participant

    That last paragraph should read “this wouldn’t apply to anyone who chose to end their subscription. This would only apply should you not be able…”

    karen james
    Participant

    A question, Brendan. Please keep in mind that this is coming from a person that has absolutely no experience in development or dealing with the App Store or how it works. I’m just throwing this at the wall as it were.

    Is there a way you could switch things to non-subscription should you find yourself in a situation where continuing to work on TFP wouldn’t be possible, and it would cause the app to become non-functional for users? Or, is there someone that you could trust with the reins temporarily, if needed.

    This wouldn’t apply to anyone who chose to end their subscription. This wouldn’t apply only because applicable should you not be able to continue your efforts with the app that would interfere with its ability to function. Just something to put out there to ease users concerns?

    Again, no clue here. Just spaghetti at the wall!

    andy bush
    Participant

    I completely understand your perspective, Brendan. You’re a single developer that’s made a database app with more functionality than most of the other ones out there. I’m wary of locking myself into an ecosystem that comes with a yearly subscription, but admittedly I can’t think of another model where you make enough money to keep this going. I think Software-as-a-service sucks but I’m not a developer. I’m a director. I’d probably be pretty frustrated if I was paid to direct an episode of TV then expected to direct the rest of the season for free.

    I wish the ‘free version’ had more functionality, like Notion but I imagine that just wouldn’t work for your current business model.

    Nigel Parrish
    Participant

    Long time user of TF5 and made the switch to pro without and hesitation. Generally I dislike subscription based apps; unless that offers a high level of support, development and as in this case supports a single or small developer whom needs the steady income stream.

    I can understand some of the concerns about TF5 not working any more but I also can see it from a developers point of view that why should he support an older app in perpetuity because people don’t like paying an annual fee. I use TFP for my one man band business for invoicing, tracking expenses and the like as well as for personal trip planning and finances.

    I think the annual subscription is a fair price – if it all went away tomorrow it would be a right hassle but that’s the way things go.

    Another app I use of Omni outliner. Currently that is a pay once programme and I have had more than my monies worth out of that and suspect it will also move to a subscription based system. I like the simplicity it offers for me to see who is what courses and the dates etc. I would probably pay for that annually because like TFP it makes my work flow easier and saves me time.

    Rereading price. I think that having access to the app across the Mac,iPhone and iPad with syncing (almost seamless) for around d £60 is pretty good and I payed and move over to TFP immediately. The only thing I would ,ike it to do is for the iPad app to be able to export custom layouts so I can send invoices away from my Mac.

    #52457
    Tap forms Forum
    Participant

    Thanks for your reply Brendan!

    Unfortunately I still don’t get it…

    I now wrote this (with the help of ChatGPT), but it still doesn’t work. Any pointers would be greatly appreciated

    function Copy_Location_Script() {
        var source_location_id = form.getFieldNamed("Source Location").getId();
        var target_location_id = form.getFieldNamed("Target Location").getId();
    
    let sourceValue = record.getFieldValue(source_location_id);
    
        if (!sourceValue || !sourceValue.latitude || !sourceValue.longitude) {
            return "Source location is not set.";
        }
    
        let lon = sourceValue.longitude;
        let lat = sourceValue.latitude;
    
        // Fetch current value of target field
        let locationValue = record.getFieldValue(target_location_id);
         locationValue.longitude = lon;
         locationValue.latitude = lat;
    
        // Save updated value back to record
        record.setFieldValue(target_location_id, locationValue);
        
        // Return debug info
        return "Target location set to: " + JSON.stringify(record.getFieldValue(target_location_id));
    }
    
    Copy_Location_Script();
    Brendan
    Keymaster

    Hi Markus,

    I understand. No worries. You have to do what you have to do. But so do I in order to earn a living while still doing what I love to do by continuing to build Tap Forms and support my customers.

    You know, there’s a great app called Ulysses which you may have heard about. It’s used by writers. They moved to the subscription model a bunch of years ago. They don’t have a lifetime option. I asked the developer recently how the transition went. He said it was rough the first couple of years, but after that he said it was the best decision they ever made. Still no lifetime option all these years later. They continue to improve and keep up with macOS and iOS releases and everyone benefits from that. I met the founder of the company a bunch of years ago at WWDC in San Francisco. Great guy. And now they have multiple employees working for the company. Perhaps if things go well enough for Tap Forms Pro, I’ll be able to do that too.

    Thanks,

    Brendan

    Markus Bode
    Participant

    Use TapForms5 2 or 3 times a month. Subscriptions doesn’t make sense for me. If no lifetime license will be offered I stay at TF5 and in case Apple discontinue Rosetta the hard way I will switch to some other piece of software. What a pity……

Viewing 15 results - 121 through 135 (of 2,990 total)