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,671 through 2,685 (of 3,049 total)
  • Author
    Search Results
  • #33678

    In reply to: Inventory & Orders

    Phil Lee
    Participant

    Thanks! That is a great starting point. I am trying to figure out how to then calculate the total number of each item ordered and subtract that from a quantity of the items received… Not sure if a script would be needed or if I am missing something obvious…

    #33669
    Brendan
    Keymaster

    The Location field value is just a dictionary. So you need to make a new dictionary object in JavaScript before you set the values on it. Essentially you’re getting a null value back from getFieldValue(). If you get a null value, then you just create an empty dictionary and then your code should work.

    var location = {};

    #33662

    I have a suble script problem:
    I want to create an artificial location field value.

    I wrote this little script:

    function SetCoordinates() {
    
    	// Durch eigenen Code ersetzen
    	var coord_id = 'fld-65d2a762b14542f9abbca1d521df2e37';
    	var title_id = 'fld-692eb15910f7433181f8f8a6b2fceccc';
    	var gps_lon_id = 'fld-4a453e4f44854f0f893d3e275d4342c4';
    	var gps_lat_id = 'fld-4dfd053afaec40b58395083e694085ac';
    	var location_value = record.getFieldValue(coord_id);
    	location_value["title"]= "GST " + record.getFieldValue(title_id);
    	location_value["lon"]=record.getFieldValue(gps_lon_id);
    	location_value["lat"]=record.getFieldValue(gps_lat_id);
    	record.setFieldValue(coord_id, location_value);
    }
    
    SetCoordinates();

    If the field coord_id has already a value this works.
    If it has no value (such es no one pressed the location icon before) this doesn’t work. How can I create an empty data structure of the type location?

    Thanks for hints

    #33633

    In reply to: Script: object TFField

    This script:

    var t = form.getFieldNamed(‘P1’);
    console.log(t.name);
    console.log(t.fieldType);
    console.log(t.fieldDescription);
    console.log(‘eoj’);

    This is the console panel

    undefined
    undefined
    undefined
    eoj

    In the Form there is a P1 field.
    What’s wrong?

    #33627

    In reply to: Script: object TFField

    Thanks.
    Can you add a property field_id?

    For make indipendent scripts From Forms, and indipendent by database, i need a function like this:

    Form.getfieldid(‘name Of field’);
    And return the field_id ‘fld…’ without open snippets.

    Gianantonio

    #33628

    In reply to: Script: object TFField

    Thanks.
    Can you add a property field_id?

    For make indipendent scripts From Forms, and indipendent by database, i need a function like this:

    Form.getfieldid(‘name Of field’);
    And return the field_id ‘fld…’ without open snippets.

    Gianantonio

    #33618
    Brendan
    Keymaster

    There’s no scripting support for adding to the Calendar.

    The very first field in your form is what’s used to generate the default Title value. You can edit the title value of course before clicking the Add to Calendar button. The link to the record is also added to the calendar.

    #33617

    In reply to: Script: object TFField

    Brendan
    Keymaster

    Hi Gianantonio,

    Right now the only things exposed are the name, fieldType, and fieldDescription properties.

    I updated the JavaScript API to document the new APIs I added:

    https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api

    #33612

    In reply to: Custom layouts in iOS

    Graeme Sheppard
    Participant

    I just wanted to register another request for custom layouts in iOS.
    I’m getting by for my use case by creating scripts to summarise information, which is a fantastic ability, but it’s a bit fiddly and not for everyone.

    I do love the scripting, though.

    #33608
    Pyromixer
    Participant

    How can I automatically enter my desired fields in the calendar?

    And can an appointment also be automatically entered in the calendar?

    Can I use a script for this? If so which code? Does anyone have any idea?

    #33607

    Please can you tell me the tffield’s struct?

    Thanks
    Gianantonio

    #33575
    Brendan
    Keymaster

    Hi Victor,

    The next update will support letting you reference another Script field within a script.

    Thanks,

    Brendan

    #33574
    Victor Warner
    Participant

    Brendan,

    In this post you showed how it is possible to use fields from a related Form.

    I am adapting the JavaScript code in other fields.

    But when I am in Edit Script, the list of fields of all Forms do not show any fields which are Script fields – so I cannot access them to declare their IDs.

    Is there a way to do so?

    #33533
    Brendan
    Keymaster

    I think I’m going to have to rethink how that deviceName property works. As you edit the records, the device name is stored on the record that edited it. But the script field also needs to be updated to show the deviceName value. And that causes a save to the database, which of course updates the database. I think I’m going to have to perhaps add something to the Script field that prevents it from updating the database, but to merely display the results. So maybe for now this is not going to work for you. Especially since if anyone else were to cause a Calculation field or a Script field to refresh across all records, they would effectively be updating every record, causing the deviceName property to be changed to their name.

    Tap Forms was never designed to be a multi-user database system and this was just a bit of a hack to see if I could display the name of the device that last made an edit to the record. It clearly needs some more thought and work.

    Sorry for getting your hopes up that this would be a viable solution.

    #33529
    Brendan
    Keymaster

    Hi Stephen,

    Yes, that’s right. Or you can just use this script:

    function Device() {
    	return record.deviceName;
    }
    
    Device();

    Try clicking the Refresh button at the bottom of the records list. You should see the value appear.

    Thanks,

    Brendan

Viewing 15 results - 2,671 through 2,685 (of 3,049 total)