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 - 676 through 690 (of 2,951 total)
  • Author
    Search Results
  • #48462
    Lane Robinson
    Participant

    Thanks Brendan,

    I’ve found that once I’ve applied styles to a Note field I can no longer paste plain text into it. There is no error in the console about this. It just doesn’t happen.

    In the other sub forum you mentioned

    I suppose you could make a record that has the settings you want in your Note field and then duplicate that record whenever you want to make a new record? You would need a bit of text in there, even a space character for the attributed string to remember its settings.

    I’ve been trying that, but I can’t see a way to append text to it in your javascript API, and with the fact I can’t even replace it with plain text once it’s been styled is going to force me in the long run to figure out how to convert richtext into an NSAttributedString.

    I have another idea for this I’m going to explore.

    #48458
    Brendan
    Keymaster

    Hi Lane,

    record.setNoteFieldValue() requires either plain text or an NSAttributedString. However, that rich text can’t really be converted to an NSAttributedString in JavaScript as far as I know. So you’ll be better off just using plain text.

    #48457
    Lane Robinson
    Participant

    brand new to javascript, but I’m reading a lot.

    so, I have this richtext

    {\rtf1\ansi\ansicpg1252\cocoartf2706
    \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 FiraSansCondensed-Regular;}
    {\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
    {\*\expandedcolortbl;;\csgenericrgb\c0\c0\c0;}
    \margl1440\margr1440\vieww11520\viewh8400\viewkind0
    \pard\tqr\tx7117\pardirnatural\partightenfactor0

    \f0\fs24 \cf2 <placeholder>}

    I don’t quite know how to convert that to an object variable that can be used with setNoteFieldValue.

    #48455
    Lane Robinson
    Participant

    Can they not have default settings one would set in layout?

    I have unformatted text with tab characters, but no formatting otherwise. This would require a person to set the same tabs for every record when new records are imported with identically tabbed, but different data. A default set of tabs from what I’d apply in layout seems like an obviously useful thing.

    I see how I can apply styles to all records in the default layout for that note. It’s an extra step that has to be remembered, but at least it avoids manually setting this for every record.

    While I can see a box for a default value for a Note field, I don’t see how I could have default formatting with that default value. So, with javascript, can I “pre-fill” this note field with a blank Text Edit file that has tabs set as I need? I could then copy the data from another form to this one (I’m already doing this for another reason). My hope would be that copying the unformatted tabbed data will take on the tab settings from the first blank line determined by the textedit file.

    Or maybe there is a better way I can’t see yet. Any thoughts on how to best proceed to essentially make a default format of a note field?

    #48441
    richard maliszewski
    Participant

    So there’s no JS API to open another form from current form. But if you can divine a record from the hope-to-viisit form, form.selectRecord(that record) will get you to the form, and a subsequent re-invocation will get you to that record. Handy stuff to stash in a form field script.

    –Richard

    #48436
    richard maliszewski
    Participant

    Brendan, does this mean that a change to a record value referenced by its field ID in a variable will also cause that record’s script(s) to execute. For example, I have code that looks like:

    var transAmtFldId = transAmtFld.getId();
    var transAmt = record.getFieldValue(transAmtFldId);

    In that form’s record script field.

    Will an externally caused change to the field value fetched into “transAmt” will cause the record’s script to run? Are you actually tracking references, or tracking explicit field ID values in code? The examples I see always seem to show the latter, but that may be for simplicity.

    –Richard

    #48433

    In reply to: Unique value

    Lane Robinson
    Participant

    I also like the comfort of having a ‘unique value’ forced on a record field, but I can live without it with auto incrementing or the UUID option. Having dug into Tap Forms enough, I bet a person could write a Script that does this. Once I’m further along in converting my old database into a Tap Forms version, I’ll revisit this and will post my solution on the forum.

    #48430
    Rolf Kickuth
    Participant

    Maybe a last question: Did as you said.
    Now I have to replace // do something (see png attached).
    Simply “return name” did not work
    What is the right command to display the name in the script field (or better in the text frame which shall be printed)?
    Thanks and best regards

    Attachments:
    You must be logged in to view attached files.
    #48427
    Rolf Kickuth
    Participant

    Thank you, good motivation, I’ll try :) Have a little publishing office (see http://www.clb.de), need data base for subscriptions. Filemaker turned out to be only a money-making machine for Apple… Migrating from Filemaker 12 on an old Mac to a modern MacBook and TapForms; good program :)

    #48426
    Brendan
    Keymaster

    FORTRAN was one of the first languages I learned too (after BASIC). Both pretty similar actually. JavaScript is not so hard and the Tap Forms Script Editor will write a lot of code for you just by double-clicking on the fields or the code Snippets available there. In fact, one of the snippets is called Child Records Loop. It’ll basically write the code for you to loop through the records of a Link to Form field picking out a value from the field you had selected on the Fields list. Just select a field in the Link to Form field that appears on the Script Editor and then double-click the Child Records Loop snippet. Bang! Code written for you.

    #48425
    Rolf Kickuth
    Participant

    Thank you for your quick response, Brendan. The reason why I took the “join”-function: I imported data sets from two former filemaker data bases. I see the problem, but filemaker solved it easier… Learned how to program 40 years ago (Fortran :), but I am not fit with javascript. Maybe I try…

    #48421
    Brendan
    Keymaster

    Hi Rolf,

    Because you’re using a Join link type between your Addresses and Letters form, there can be multiple addresses per letter and multiple letters per address. So the technique of getting a value from the parent form to display on the child form won’t work directly. You would have to add a Script Field that selects the specific record you want from the parent. Now maybe there’s only one in your case, but there’s still an array of them. Just containing only 1 record. You then have to get that record and then ask it for its value which you could return in the Script Field.

    #48418

    In reply to: global field?

    Brendan
    Keymaster

    Evenen though the Join Link Type allows you to have only one field for the join, you can add a Calculation or Script field to join two other fields together, so then you could use that as the Join field. As long as you had the same kind of field concatenating the two fields on the other side of the join.

    There’s no function to NOT print a specific field on a custom layout. But you can have multiple layouts, one for data entry that does have the field and another for printing purposes that doesn’t include said field.

    #48416
    Lane Robinson
    Participant

    I was looking for a way I can create an invoice from a saved search of ad work orders. Since there doesn’t appear to be a way to ask for record from a Saved Search of a Form, only the entire set of records in the form, I then tried a linked form Join to match two different fields, not just one, to get the set of records I need into an invoice. Which I also can’t do. In simple terms, I need to match for the client *and* for the issue of a ‘magazine’ and get only those ad work order records.

    I have a way that can work, but isn’t, um, in my face enough to make sure I don’t choose incorrectly. I’m auto entering an issue number by setting that field’s default value in the fields tab. So when I create a new invoice, the issue number is entered automatically based on that default. Together with the client ID number I can get the correct set of records from the ad work orders Form. This can work because we tend to invoice a batch invoices for the same issue at the same sitting. But we do sometimes do more than one issue at a sitting. There can be errors made if someone forgets to go into the Forms Fields and change the default entry to the correct issue number. People actually doing the invoice have discomfort with going into the Fields tab for the form, and I’d probably rather didn’t go in there either!

    To avoid errors with this, I was hoping there could be a way to have what I’ll call global field (sort of like a global variable) that is big and bright and above everything else that displays the issue number we are working in. We change that, and we could write a script that uses that field to auto enter the issue number on to the invoice. This is basically what we have with our previous <!–voldemort pro–> database.

    Another way may be to create a new layout that has this field at the top in large red type, but could we set such a field to not print?

    We do this not just with invoices, but actually even more so with reports. I mention the invoice example as that’s the place we can make errors that are more embarrassing. :) Whatever advice can be offered is welcome and appreciated.

    #48412
    richard maliszewski
    Participant

    So I have a form I do not want edited directly. Some fields are updated based on calculations performed upon other forms by the form in question’s script.

    I enabled access controls for the form, setting a password, yada, yada. Turned everything off, basically locking the form. Two questions/issues:

    1) having done this, does this mean calcuations also cannot update fields, or does it just prevent direct entry?

    2) having done this, I tried changing a non-calculated field in the form. TF did not stop me. Switched to another form, switched back, changed field was still changed. This suggests to me that locking the form did nothing useful. The name of this field is used for access to compnaion forms…I’d rather it didn’t just succumb to accidental entry. Am I missing something?

    –Richard

Viewing 15 results - 676 through 690 (of 2,951 total)